Skip to content

Conversation

@jjw24
Copy link
Member

@jjw24 jjw24 commented Mar 14, 2021

'Index Search Excluded' path does not kick in when using Windows Index to search for files and folders. This adds an exclusion call to filter out the index search result from exclusion list.

closing #384

@jjw24 jjw24 added the bug Something isn't working label Mar 14, 2021
@jjw24 jjw24 self-assigned this Mar 14, 2021
@jjw24 jjw24 enabled auto-merge March 14, 2021 19:06
@jjw24 jjw24 requested review from JohnTheGr8, SysC0mp, gdziedzic and taooceros and removed request for JohnTheGr8, SysC0mp, gdziedzic and taooceros March 15, 2021 20:44
@taooceros
Copy link
Member

Do we exclude any path before this pr?

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

Yeah we do, but only for directory search, meaning if you search 'c:\users\user1\', and that path is excluded, then directory info search will kick in. However if you search 'user1', windows index search will kick in even if you have added that path in the exclusion list.

This pr is to fix it so windows index search won't kick in either if you search 'user1' folder.

@taooceros
Copy link
Member

Yeah we do, but only for directory search, meaning if you search 'c:\users\user1', and that path is excluded, then directory info search will kick in. However if you search 'user1', windows index search will kick in even if you have added that path in the exclusion list.

This pr is to fix it so windows index search won't kick in either if you search 'user1' folder.

So why not merge them into one filter before returning the result list?

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

What do you mean? The union?

@taooceros
Copy link
Member

What do you mean? The union?

I mean merge the exclusion filter for index search and directory search together by changing the place filtering to the end of SearchAsync method. We can do the filter together instead of separate in directory search and windows search.

We can remove the check for exclusion in Directory search and use the one we use here to do it by putting that here.

results.UnionWith(directoryResult);
return results.ToList();

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

Geat suggestion actually. What about adding it in the index search class, makes more sense right.

@taooceros
Copy link
Member

Geat suggestion actually. What about adding it in the index search class, makes more sense right.

But I think that class doesn't include direct directory traverse without index, right?

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

No but this exclusion is only for Windows Index searches

@taooceros
Copy link
Member

No but this exclusion is only for Windows Index searches

But that will make folder with Indexes have different behavior comparing to those folder without indexes when traversing? Because all index search calls this method.

@taooceros taooceros added the Explorer Plugin Issue or Enhancement Link to Explorer Plugin label Mar 16, 2021
@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

Yeah that's what the exclusion is for. When the path is added in the list, searching directly in the folder will not use windows index but will use directoryinfo search. When searching for a file or folder, you will not get any matches if their path is in the list.

It's like turning off that path from indexing options, this is just a shortcut to do it.

@taooceros
Copy link
Member

Yeah that's what the exclusion is for. When the path is added in the list, searching directly in the folder will not use windows index but will use directoryinfo search. When searching for a file or folder, you will not get any matches if their path is in the list.

It's like turning off that path from indexing options, this is just a shortcut to do it.

Yeah I mean the indexSearch class is both for directoryInfo search and global folder and file search if the folder is inside the index. We are supposed to only filter result for global index search right?

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

No, DirectoryInfo search is in its own class. These two are seperated

@taooceros
Copy link
Member

No, DirectoryInfo search is in its own class. These two are seperated

Sorry I misremember the name of the class. However, both directory search and index search can be used for > search in a folder (index search will be used when the folder is in the index). Therefore, putting the exclusion to index search can make these two behave differently, though should not be significant.

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

No, DirectoryInfo search is in its own class. These two are seperated

Sorry I misremember the name of the class. However, both directory search and index search can be used for > search in a folder (index search will be used when the folder is in the index). Therefore, putting the exclusion to index search can make these two behave differently, though should not be significant.

Oh good point abt '>'. But this would be consistent behaviour right? In that, if it's excluded, it's excluded. If it returns results then doesnt that mean this is a bypass function for exclusion?

Although, having said all that, I have been thinking to change '>' to bypass index search so this is a functions to always get results regardless of the exclusion. Like an override function

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

Additionally, content search will be excluded too as it as it uses index search

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

Maybe in the the future we can add in options for users to choose whether to apply the exclusion for:

  • in-directory searches,
  • file/folder name searches, or
  • file content searches

@jjw24
Copy link
Member Author

jjw24 commented Mar 16, 2021

@taooceros I have moved the exclusion method. Let me know what you think.

@taooceros
Copy link
Member

LGTM, I will approve it.

@jjw24 jjw24 merged commit 647e2b4 into dev Mar 16, 2021
@jjw24 jjw24 deleted the fix_windowsindex_exclude branch March 16, 2021 11:03
var constructedQuery = constructQuery(searchString);
return await ExecuteWindowsIndexSearchAsync(constructedQuery, connectionString, query, token);
return await RemoveResultsInExclusionList(
await ExecuteWindowsIndexSearchAsync(constructedQuery, connectionString, query, token),
Copy link
Member Author

@jjw24 jjw24 Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taooceros should ConfigureAwait(false) and cancellation token be added for the two methods?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you are right!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Explorer Plugin Issue or Enhancement Link to Explorer Plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants