File Find - Boolean order matters?

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

File Find - Boolean order matters?

Post 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.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: File Find - Boolean order matters?

Post 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.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: File Find - Boolean order matters?

Post 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.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: File Find - Boolean order matters?

Post 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.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: File Find - Boolean order matters?

Post 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! :D

Maybe add something to the Help about this...

Thx

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: File Find - Boolean order matters?

Post 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.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: File Find - Boolean order matters?

Post 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? :lol:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Stef123

Re: File Find - Boolean order matters?

Post 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 :titter:
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

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: File Find - Boolean order matters?

Post 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.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: File Find - Boolean order matters?

Post 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)

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: File Find - Boolean order matters?

Post 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. :oops:

Post Reply