Page 1 of 1

Unexpected results on AND mode in search

Posted: 27 Jan 2019 11:17
by aubrey97
I am getting very unexpected results using AND in searches. Not sure whether it is my misunderstanding, or whether there is some sort of a bug involving (particularly) the way in which comment tags are handled. Normally one would expect AND to produce the union of the two independent searches, but this is not what happens. Take this example:

Search 1: Looks for all files with the tag latexdone on my X drive, using

X:\?tags:latexdone /r /t

The result is correct showing 2766 items all of which have that tag:
xypl1.png
xypl1.png (55.83 KiB) Viewed 587 times
Search 2: Looks for all files with a comment using

X:\?!cmt:"" /r /t

As far as I can figure out the only way to do this is to do an inverse search on the tag database looking for null comment as above. The result too is correct showing 3 items with a comment (none of which happen to have the Latexdone tag)
xypl2.png
xypl2.png (50.96 KiB) Viewed 587 times
Search 3: Looks for all files with both of the above using

X:\?!cmt:"" & tags:latexdone /r /t

As it happens I am using click and search but that is by the by

The result here should be no files. However the union picks up 23 files, none of which are in the union of searches 1&2, but all of which have any unrelated entry in the tag database (any comment or label) and do not have the latexdone tag.
xypl3.png
xypl3.png (57.55 KiB) Viewed 587 times
What is wrong with my syntax?

What it is picking up is all files in the tag database which do NOT have the latexdone tag. I cannot work out how that fits with the syntax, or the operation of the AND facility in the click and search.

Re: Unexpected results on AND mode in search

Posted: 28 Jan 2019 04:21
by jupe
try changing this option:

Configuration | Find and Filter | Find Files & Branch View | Find Files | Enable smart Boolean query parsing

or prefixing your search with a colon, also /r is the default so it isn't required, you don't have to invert the cmt: either, e.g. this should work too (regardless of the above setting):

Code: Select all

x:\?:cmt:?* AND tags:latexdone

Re: Unexpected results on AND mode in search

Posted: 28 Jan 2019 11:17
by aubrey97
Thanks for the help. Changing the cmt search to a method without inversion solves it, but raises questions then about use of inversions in booleans.
Smart boolean was already checked.

Why would the first method not have worked, as we had the union of two valid expressions ?

Re: Unexpected results on AND mode in search

Posted: 10 Feb 2019 17:30
by admin
I cannot reproduce a failure with your syntax. Works just as well as jupe's one over here.

Only your switch was wrong, maybe that was somehow causing it (though not here):
RIGHT: /rt
WRONG: /r /t