Search syntax [solved]: Need help defining the right scope for a smart rule


I’m trying to use a Smart Rule to tag items if they meet specific search criteria. Having tried different things but not gotten it to work as desired until now, any input would be appreciated.

In this case, the objective is to tag all PDFs that contain a certain term in the PDF annotations, but that do not contain any instances of the term that are not followed by “done”. Another way to put it: I only want to tag PDFs in which the search term is always followed by “done”.

Searching for “term1 NEXT term2” won’t do it here because it would show any document with these two terms following each other, even if the term is also contained in that PDF without being followed by “done”.

This is what I tried: I set a Smart Rule to search All and entered different variations of the following:
“xx3 AND NOT (xx3 NOT BEFORE/1 done)”. Doesn’t produce the desired results as described above.

Is something wrong with my search syntax? Thanks in advance.

Note: The content of PDF annotations is considered as part of the text/content of the file. There is no separation, unless @cgrunenberg has something under-the-hood I’m unaware of.

This is a search for a specific term followed by done

Thanks, @BLUEFROG.

Good to know that PDF annotations are treated as part of the Content.

As noted in the original post, searching for Term1 followed by Term2 is insufficient for what I’m trying to accomplish. Any document containing term1 followed by term2 would be found, even if the document also contains only Term1 not followed by Term2.

I got it to work as I envisioned and want to share the syntax, in case someone else here is trying to do something similar.

These are the two conditions:
Content matches Term1
Content matches NOT (Term1 NOT NEXT done & Term1 NOT NEXT abort)

I continue to be amazed at the versatility DT offers. Months in I am still learning… :slight_smile:

1 Like

Hopefully the learning never stops. I’m over 9 years in and still learn new things about DEVONthink all the time.