Cannot set case sensitivity to Fasle in API

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
mrkozma
Posts: 6
Joined: Fri Dec 03, 2021 3:19 pm

Cannot set case sensitivity to Fasle in API

Post by mrkozma »

Hello,

I am using the following code to search for files using a home built .NET service.
The service fails to find files when case is not matched in the search term.

This is the main part of code that should be relevant.

Can you help to correct it?

Thank you!

Code: Select all

  public static IEnumerable<Result> Search(string qry, ILogger _logger)
        {
            var results = new List<Result>();

            // set the search
            Everything_SetMatchCase(false);
            Everything_SetSearchW(qry);
            Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_DATE_MODIFIED | EVERYTHING_REQUEST_SIZE);

            // execute the query
            Everything_QueryW(true);
            var resultCount = Everything_GetNumResults();

            var foundFileId = 0;
            // loop through the results, generating result objects
            for (uint i = 0; i < resultCount; i++)
            {
                if (Marshal.PtrToStringUni(Everything_GetResultFileName(i)) != qry)
                    continue;

                var sb = new StringBuilder(999);
                Everything_GetResultFullPathName(i, sb, 999);
                Everything_GetResultDateModified(i, out long date_modified);
                Everything_GetResultSize(i, out long size);

                _logger.LogInformation($"\tpath {++foundFileId}: {sb.ToString()}");

                results.Add(new Result()
                {
                    DateModified = DateTime.FromFileTime(date_modified),
                    Size = size,
                    Filename = Marshal.PtrToStringUni(Everything_GetResultFileName(i)),
                    Path = sb.ToString()
                });
            }

            _logger.LogInformation($"!--Searching '{qry}' -> found {results.Count} match(es)");
            return results;
        }
void
Developer
Posts: 16747
Joined: Fri Oct 16, 2009 11:31 pm

Re: Cannot set case sensitivity to Fasle in API

Post by void »

The default search state is to ignore case.

Please try without calling Everything_SetMatchCase.

-or-

Please try calling:
Everything_SetMatchCase(0);
-There might be an issue with the false statement?

How have you declared Everything_SetMatchCase?
-Please make sure BOOL is declared as an int (not a byte).



Please try running Everything in debug mode and checking the requested search:
  • In Everything, type in the following search and press ENTER:
    /debug
    --this will show the debug console--
  • Perform your IPC call
  • What is shown in the debug console?
  • It should look something like:

    Code: Select all

    term 0000000026109f40, flags: 3140, next: 0000000000000000, notnext: 0000000000000000
    folderop: 2, fileop: 2, term: my-search
    where the case flag is 0x00000001
mrkozma
Posts: 6
Joined: Fri Dec 03, 2021 3:19 pm

Re: Cannot set case sensitivity to Fasle in API

Post by mrkozma »

Thanks.

I tested the application without calling Everything_SetMatchCase -> Same behavior.

Called Everything_SetMatchCase(0) -> Did not accept it, expected a boolean value.

Regarding how Everything_SetMatchCase was declared: I am not sure. I used a sample code from GitHub: https://github.com/dipique/everythingio ... rything.cs Which is very similar to the sample code on your site: https://www.voidtools.com/en-au/support ... dk/csharp/

I ran the /debug mode when I searched with my application, the debug window did not change even though my app was returning results. It changed when I searched through the Everything client window.

One possibly important thing to mention: my application is running as a service, I also installed Everything Client as a service. See this post: viewtopic.php?f=5&t=10870

The application performs well, meaning finds everything except that I have this case sensitivity issue.

Any other suggestions? Thank you for your help.
void
Developer
Posts: 16747
Joined: Fri Oct 16, 2009 11:31 pm

Re: Cannot set case sensitivity to Fasle in API

Post by void »

Please make sure you are not using the case: modifier in your search.
For example: case:<FOOBAR> would match case.

If you are using Everything 1.5, please make sure you are not referencing a filter or bookmark that enables match case.

Please try stopping the client service, running Everything as a normal user in debug mode and checking the IPC request:
  • Stop the Everything client service with: Everything.exe -stop-client-service
  • Run Everything.exe as an admin.
  • Put Everything in debug mode: In Everything, type in the following search and press ENTER:
    /debug
  • Perform your IPC request.
  • What is shown in the Everything debug console?
  • Exit Everything (File -> Exit)
  • Restart your client service with: Everything.exe -start-client-service
mrkozma
Posts: 6
Joined: Fri Dec 03, 2021 3:19 pm

Re: Cannot set case sensitivity to Fasle in API

Post by mrkozma »

I am using Everything.exe version 1.4.1.969
I am not using case modifier

I stopped the client service
Ran Everything.exe as an admin
Put Everything in debug mode
Performed the request
Nothing was shown in the debug console. But I think this was expected since we took Everything search out of session 0 and my API service could not reach Everything in session 1, per viewtopic.php?f=5&t=11853

Once I started Everything client service, my API service was able to find the file, but with case sensitivity on.

Do you have an updated Everything64.dll, shall I run the latest Everything client as a servcie?
void
Developer
Posts: 16747
Joined: Fri Oct 16, 2009 11:31 pm

Re: Cannot set case sensitivity to Fasle in API

Post by void »

Please try upgrading to the latest version of Everything.

The latest SDK with match case disabled is working as expected for me.

It might be easier to enable debug logging on the client service:
  • Stop the Everything client service with:
    Everything.exe -stop-client-service
  • Edit your Everything.ini in the same location as your Everything.exe
  • Change the following line:
    debug_log=0
    to:
    debug_log=1
  • Restart the Everything client service with:
    Everything.exe -start-client-service
    ---
  • Perform your IPC request.
    ---
  • Stop the Everything client service with:
    Everything.exe -stop-client-service
  • Edit your Everything.ini in the same location as your Everything.exe
  • Change the following line:
    debug_log=1
    to:
    debug_log=0
  • Restart the Everything client service with:
    Everything.exe -start-client-service
What is shown in your C:\Windows\TEMP\Everything Debug Log.txt file?
Post Reply