Fix bug preventing from searching with multiple filters
Context
When searching with a query containing multiple extension
or filename
filters, the query only considers the first occurrence of extension
or filename
.
For example:
'my_method -extension:rb -extension:yml'
equates to:
'my_method -extension:rb'
Similarly,
'my_method -filename:spec -filename:html'
equates to:
'my_method -filename:spec'
This is true for both inclusive and exclusive filters.
Example:
'android extension:yml -extension:gitlab-ci.yml'
Should yield all .yml
files except for gitlab-ci.yml
files. But because the second filter isn't considered, we get back gitlab-ci.yml
files in our results.
As a user, I expect that searching with multiple filters would result in all of the filters being applied so that I can narrow my results.
Fix
In order to apply all cases of a filter and not just the first occurrence, I'm suggesting a loop to get all occurrences of a filter match and create filters for those as needed.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #273162 (closed)