Searching for EXACT file name matches irrelevant files
Answered
Hi I am on IntelliJ IDEA 2019.3.5 (Ultimate Edition) I'm trying to use Ctrl+Shift+N to search for a file called say Models.inf If I search for "Models" I get any file which has the word "models" in it which is ok I suppose
So I've started using /Models with the slash and this shows any file that starts with Models which is better but as soon as I enter "/Models.inf" I effectively get any file that has "s.inf" in it like ValidationRules.inf !.
What is the best way to avoid this I can't find a setting that will allow me to tailor how the search works
Thank you in advance
Please sign in to leave a comment.
Just tested in 2020.1.1 and /Models.inf doesn't match ValidationRules.inf. Please try with the latest version. If the issue persists, share a sample project to reproduce the issue: https://uploads.services.jetbrains.com/.
You can also try disabling the middle matching by adding -Dide.goto.middle.matching=false in Help | Edit Custom VM Options and restarting the IDE.
Hi Serge Thanks for the replies I've done a bit more investigation and it appears the matching is occuring because Intellij is partially matching against folder names
I have got numerous modules with the folder names of xxx.models.xxxx etc. If I search for /Models.inf via Ctrl + Shift + N it is matching against files that are in a folder whose name contains "model" and that have a suffix of "s.inf" So it is finding say ValidationRules.inf. but only if it is in a directory whose name contains "model"
I'm not sure there is an easy way around this. Is it possible to stop Ctrl Shift N using the folder name as a part match?? I can't see a scope option that I can use
I have uploaded a file called matchingQ.zip that contains a project that shows this happening Also it contains a jpg that shows the result of the File search and how it is part matching against the folder name (the module name can be anything). I have tried using -Dide.goto.middle.matching=false but it doesn't change anything
Cheers
Thanks for the sample. You are right, it's a known limitation, please follow https://youtrack.jetbrains.com/issue/IDEA-195207 for updates. See https://intellij-support.jetbrains.com/hc/articles/207241135 if you are not familiar with YouTrack.
With your sample project Models.inf is the first result anyway, so what is the real problem with finding this file? Do you want IDE to hide any other matches?
Yes you are correct it's not a major problem
I suppose I was expecting that when I do a search for /Model Iwould expect it to only return files that start with Model however in my case as I have folders with Model in them I get all the folder matches (which is a lot) up until the point I enter the full Models.inf and then I get confusing matches that partially matches the folder plus part of the file name
It would be nice to have a file search that purely uses the file name and the folder name is irrelevant or an option to do this.Using a / doesn't seem to force the search to only show files that start with the search criteria either