OR syntax seems to fail

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
terrypin
Posts: 208
Joined: Mon Mar 18, 2013 2:41 pm

OR syntax seems to fail

Post by terrypin »

If I use the following search I get hits only on D:
*_DSC*.jpg c:|*_DSC*.jpg d:

And
*_DSC*.jpg d: | *_DSC*.jpg c:
gives only hits on C:

Why am I not getting hits on both drives please/

Terry
void
Developer
Posts: 16676
Joined: Fri Oct 16, 2009 11:31 pm

Re: OR syntax seems to fail

Post by void »

*_DSC*.jpg c:|*_DSC*.jpg d:
is the same as:
*_DSC*.jpg <c:|*_DSC*.jpg> d:
Note: < and > for grouping

*_DSC*.jpg d: | *_DSC*.jpg c:
is the same as:
*_DSC*.jpg <d: | *_DSC*.jpg> c:

Please try changing your OR precedence:
  • In Everything, from the Tools menu, click Options.
  • Click the Search tab on the left.
  • Change Operator precedence to: AND > OR
  • Click OK.
Now...

*_DSC*.jpg c:|*_DSC*.jpg d:
is the same as:
<*_DSC*.jpg c:> | <*_DSC*.jpg d:>

*_DSC*.jpg d: | *_DSC*.jpg c:
is the same as:
<*_DSC*.jpg d:> | <*_DSC*.jpg c:>
terrypin
Posts: 208
Joined: Mon Mar 18, 2013 2:41 pm

Re: OR syntax seems to fail

Post by terrypin »

Thanks. Presumably that's because of the space in each of my search strings? If so why not group both of them? This
<*_DSC*.jpg c:> |<*_DSC*.jpg d:>
seems to work OK and is more intuitive IMO.

Terry
void
Developer
Posts: 16676
Joined: Fri Oct 16, 2009 11:31 pm

Re: OR syntax seems to fail

Post by void »

The spaces around a | are ignored.

I've just noticed you have two *_DSC*.jpg

It would be easier to do:
*_DSC*.jpg c: | d:

which is the same as (when using OR > AND precedence):
*_DSC*.jpg <c: | d:>
Last edited by void on Thu Dec 24, 2020 9:52 pm, edited 1 time in total.
Reason: Added (when using OR > AND precedence)
terrypin
Posts: 208
Joined: Mon Mar 18, 2013 2:41 pm

Re: OR syntax seems to fail

Post by terrypin »

Thanks. At first
*_DSC*.jpg c: | d:
didn't seem to work, with results only in D:
But then I discovered Everything had reverted to the' AND > OR' setting. Changing that back to 'OR > AND' worked correctly.

However it seems that the safest syntax is
<*_DSC*.jpg c:> | <*_DSC*.jpg d:>
as I don't want to have to first check (or change) the precedence settings. Of course, that assumes I do remember to group any string that contains a space, as is always the case when I'm just searching on more than one drive.
Last edited by terrypin on Thu Dec 24, 2020 2:56 pm, edited 1 time in total.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: OR syntax seems to fail

Post by NotNull »

What is your current Operator precedence? (see above)

It should be OR > AND (the default) for this to work.
terrypin
Posts: 208
Joined: Mon Mar 18, 2013 2:41 pm

Re: OR syntax seems to fail

Post by terrypin »

I suspect our posts crossed while I was editing mine. That is now my default.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: OR syntax seems to fail

Post by NotNull »

terrypin wrote: Thu Dec 24, 2020 2:34 pm However it seems that the safest syntax is
<*_DSC*.jpg c:> | <*_DSC*.jpg d:>
as I don't want to have to first check (or change) the precedence settings. Of course, that assumes I do remember to group any string that contains a space, as is always the case when I'm just searching on more than one drive.
This suggested syntax by void should work regardless too:

Code: Select all

*_DSC*.jpg   <c: | d:>
terrypin
Posts: 208
Joined: Mon Mar 18, 2013 2:41 pm

Re: OR syntax seems to fail

Post by terrypin »

Yes, thanks, works fine, and saves a pair of group brackets too.
Post Reply