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;
}