Beginner fails at “#upper:"abc 123"”

Discussion related to "Everything" 1.5 Alpha.
Post Reply
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Beginner fails at “#upper:"abc 123"”

Post by ChrisGreaves »

Hi yu'all.
I read the topic Search Preprocessor and the threads Suggestion: Rename "Preprocessor" to "search functions" and Search Preprocessor Suggestions and Search Preprocessor Suggestions and gather that Search Preprocessor is working.
That suggests that I have failed to grasp some basic understanding of Preprocessor functions
Preprocessor_01.png
Preprocessor_01.png (37.96 KiB) Viewed 1181 times
I tried the example from the topic Search Preprocessor and although “#upper:"abc 123"” is supposed to search for “ABC”, the result list shows “abc”
Preprocessor_02.png
Preprocessor_02.png (28.33 KiB) Viewed 1181 times
Evaluating the search command with a prefix “/” evaluates to upper-case.

In the case of "upper", I figure that I will rarely have a literal string such as "abc", but instead some sort of labeled value to be forced into upper-case.
The search command example (2nd image) show me that "upper" does indeed force upper-case, but trying to force upper case shows entries bolded with the lower-case "abc" and "123".

A basic search "abc" returns 576 objects.
As does the search ":ABC".
WAIT!
I might have worked it out myself: The preprocessor function "upper" is a command that tells Everything "how to behace from now on" and will be applied to every search string I key in after this time (until reset).
Is that closer to the truth?


Thanks for any suggestions. Chris
PS. The laptop arrived yesterday, so I hope to be on the new system by Monday. C.
Michi
Posts: 69
Joined: Thu Jul 28, 2022 9:23 am

Re: Beginner fails at “#upper:"abc 123"”

Post by Michi »

Shouldn't you include the preprocessor expression in brackets? Did not use such expressions so far, though.

Like

Code: Select all

[upper:"abc 123"]
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Beginner fails at “#upper:"abc 123"”

Post by ChrisGreaves »

Michi wrote: Fri Mar 03, 2023 3:31 pm Shouldn't you include the preprocessor expression in brackets? Did not use such expressions so far, though. Like

Code: Select all

[upper:"abc 123"]
Thanks Michi. Your comments have increased my knowledge (I think)
Preprocessor_03.png
Preprocessor_03.png (41.57 KiB) Viewed 1171 times
First I tried a literal test, typing my surname with CapsLock ON. This produced the results shown above
Preprocessor_04.png
Preprocessor_04.png (41.63 KiB) Viewed 1171 times
Then I tried your example, but using my name in lower-case (and adding the missing double-quote: It was hiding on MY keyboard right next to the <Enter> key :twisted: :lol: ) but this didn't work.
So I tried

Code: Select all

case:[upper:"greaves"]
with the results you see above.

This is starting to make sense.
The construct [upper:"greaves"] causes the pre-processor to replace my string with the result of the processing. That is, my string [upper:"greaves"] is replaced with the string "GREAVES".
So far so good, but now we need to make use of "GREAVES" and so we apply the Search Modifier case:

The search modifier case: tells Everything to look for upper-case versions of "greaves".
The Preprocessor Function(?) tells Everything that I am too lazy to use Caps-Lock,

My mind was locked into the thought "this is a search string" instead of "once this has been pre-processed, it will be a search string".

Cheers, and thanks again.
Chris
Last edited by ChrisGreaves on Tue Mar 07, 2023 1:47 pm, edited 1 time in total.
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Beginner fails at “#upper:"abc 123"”

Post by void »

The Preprocessor Function(?) tells Everything that I am too lazy to use Caps-Lock
You will unlikely type in [upper:] for a normal search.

The Everything Preprocessor might be useful for setting the search from the command line or filter.



Consider the following filter:
Name: My Uppercase Search
Search: case:<#<upper:search:#>:>
Macro: myupper<search>
Activate the filter and search for greaves



Consider the following myupper.BAT file:

Code: Select all

Everything.exe -s case:[upper:%1]
myupper greaves
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Beginner fails at “#upper:"abc 123"”

Post by ChrisGreaves »

void wrote: Mon Mar 06, 2023 4:31 amYou will unlikely type in [upper:] for a normal search.
Thank you Void; this helps to explain why I struggled to set up an example in a normal search! :lol:

I still don't know enough about Everything, and have not (yet) explored macros, so I have bookmarked your response for consumption down the road.
Still and all, thanks for the response.
Cheers, Chris
ChrisGreaves
Posts: 684
Joined: Wed Jan 05, 2022 9:29 pm

Re: Beginner fails at “#upper:"abc 123"”

Post by ChrisGreaves »

void wrote: Mon Mar 06, 2023 4:31 am Consider the following filter:
Consider the following myupper.BAT file:
I love BATch files!
CommandLine_03.png
CommandLine_03.png (28.49 KiB) Viewed 1038 times
Working backwards, this happens:-
(1) From the DOS CMD.exe window we run the batch file “upper” with the parameter “greaves”
(2) This causes Windows to execute the command

Code: Select all

Everything64.exe -s case:[upper:%1]
(3) Everything64.exe is started and receives the command string “-s case:[upper:greaves]”
(4) The “-s” tells Everything to execute a search.
(5) The %1 has been expanded (by CMD.EXE) to the value of the first parameter to the batch file, hence it is replaced by “greaves”
(6) The square-bracketed term “[upper:greaves]” is processed by the Everything pre-processor and, naturally, evaluates to “GREAVES”
(7) The modifier “case:” tells Everything to enforce case-sensitivity, that is in this example to look only for “GREAVES” all in upper case, not lower-case, not a mixture.
(8) I test this theory by typing in “case:GREAVES” in the search box; the same three files will appear.
(9) Note that in the image above, that search string was NOT typed in by hand. It arrived by virtue of the operations described here by the batch file and the preprocessor.

Exercise (6) Why do we get two different results from”case:GREAVES” and “GREAVES”
CommandLine_04.png
CommandLine_04.png (75.01 KiB) Viewed 1038 times
Because in the second example where we happen to supply an upper-case string, we have not specified that we are interested only in upper-case. In this case Everything finds any mixture of upper- and lower-case alphabetics that satisfies the seven letters provided.

Owzat?
Cheers, Chris
Post Reply