Page 1 of 1
File Find - Boolean order matters?
Posted: 21 Aug 2015 18:51
by Papoulka
This may not be a bug, but is worth reporting at least as unexpected. Using File Find / Boolean mode...
Does (as expected) exclude files w "keep" in name:
Code: Select all
:*.jpg AND (!keep) AND (!prop:ImageY:1100)
Does NOT exclude files w "keep" in name:
Code: Select all
:*.jpg AND (!prop:ImageY:1100) AND (!keep)
Both do, as expected, exclude files with the specified Y dimension.
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 19:18
by admin
Not a bug:
The field is propagated to the right. So your search term is implicitly this:
:*.jpg AND (!prop:ImageY:1100) AND (!prop:keep)
But what you want and need to do is this:
:*.jpg AND (!prop:ImageY:1100) AND (!name:keep)
In other words, "name" is NOT the default field.
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 19:41
by Papoulka
But what you want and need to do is this:
:*.jpg AND (!prop:ImageY:1100) AND (!name:keep)
Got it.
But - what confused me is that my first example worked:
Code: Select all
:*.jpg AND (!keep) AND (!prop:ImageY:1100)
Shouldn't it also have to be changed i.e. to:
Code: Select all
:*.jpg AND (!name:keep) AND (!prop:ImageY:1100)
Maybe the answer to that is implicit in your statement that "The field is propagated to the right" but if so I don't quite see it.
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 20:16
by admin
:*.jpg AND (!keep) AND (!prop:ImageY:1100)
The default initial field (in the absence of any field prefix) is Name. So *.jpg is Name, and !keep as well since Name propagates to the right (until a field prefix is met: prop:). I find this quite natural.
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 20:45
by Papoulka
(until a field prefix is met: prop:)
OK, now I understand, and I see how it comes about from the programmer's point of view. But IMHO a user would more naturally expect each Boolean "spec" to be scanned independently. So in
Code: Select all
:*.jpg AND (!prop:ImageY:1100) AND (!keep)
I would never have expected 'prop' to work on 'keep'. They're so far apart! And there's all those parentheses and stuff between them!
Maybe add something to the Help about this...
Thx
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 20:51
by admin
No time to check now but I'm quite sure that this is in the Help.
I recommend to always prefix all terms in such multi-field searches.
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 20:53
by bdeshi
At risk of hijacking the topic, I must confess to making mistakes nearly like this way too often. Maybe we could have something like a step mode for search patterns?

Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 20:56
by Stef123
It definitely must be in help somewhere, because I have it highlighted in my private wiki-notes, bold and surrounded by danger-signs
Step mode sounds like a good idea, though. Very often I wish I could just click Visual Filters or QuickSearch again, then put another one top of the existing one, with options AND and OR
Re: File Find - Boolean order matters?
Posted: 21 Aug 2015 22:03
by Papoulka
The XY Help for "File Find - Boolean" has no info regarding a field spec propagating / having a persistent effect to the right. A link to where this does appear could be enough.
Re: File Find - Boolean order matters?
Posted: 22 Aug 2015 09:37
by admin
It's there:
Field Type Inheritance
The 3rd example above shows that the field type is inherited from left to right. This is done for backward compatibility and also for comfort. The following pairs are equivalent:
lent: > 12 AND < 20
lent: > 12 AND lent: < 20
tags:cats|dogs AND ants OR name:a* AND *.png
tags:cats|dogs AND tags:ants OR name:a* AND name:*.png
a* AND (*.png OR lbl:green OR yellow OR red)
name:a* AND (name:*.png OR lbl:green OR lbl:yellow OR lbl:red)
Re: File Find - Boolean order matters?
Posted: 22 Aug 2015 17:42
by Papoulka
You're right of course. I overlooked it twice even after knowing what to look for. Sorry you had to take the extra-extra time.
