135

I know that is used to search : Ctrl+Shift+F or Edit | Find | Find in Path and it worked before, but now always returns the empty set, although I know that what I'm looking for - there is in the project

Maybe someone had this problem?

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
Lola
  • 2,591
  • 6
  • 24
  • 49
  • 1
    What is your `Scope` set to? I've found that IntelliJ likes to sometimes set itself to the `Directory` scope instead of `Whole project` after performing a search. – ajp15243 Dec 12 '14 at 06:16
  • 2
    I chose the Scope in different ways, even reinstall the program. need to clean karma :) – Lola Dec 12 '14 at 06:25
  • 71
    please try invalidating caches (File/Invalidate caches, restart) - does it help? – lena Dec 12 '14 at 13:08
  • 2
    Thanks, I was having the same issue. Search kept on saying: "Usage search was cancelled". I invalidated my caches and restarted now it's fine. – mikkelz Jan 09 '15 at 14:11
  • 1
    Invalidating cache fixes the same issue in InteliJ Idea as well. – Chathurika Sandarenu Dec 07 '15 at 06:48

8 Answers8

380

As lena said, the following should fix it for you:

  1. Click File -> Invalidate Caches / Restart..
  2. Click the button "Invalidate and Restart"
  3. After restart, try run the search again
nbaosullivan
  • 4,034
  • 3
  • 21
  • 14
  • I'm using PHPStorm 8.0.3. That is also REALLY KILLING my productivity. I have some problems with SSHFS on Linux - unfortunalety, problems persist and are unresolvable. I' experiencing disconnects from SSHFS mount. I must invalidate my caches then and restart PHPStorm. My project contains few projects in reality, so indexing last about 10 minutes. Before that, I must click Scope->directory in 'Find in Path' dialog. – mrarm Mar 22 '16 at 08:22
  • Another note: do not forget to uncheck regular expression when u dont need :) – ufukgun May 03 '16 at 12:01
  • I was using the active dev environments Ubuntu VM to search on command line for months. Thanks and I hope it sticks. Could have been switching files with git or what that triggered it I'm not sure. Maybe it was a trial of a newer version? – Master James Jan 21 '17 at 12:02
  • 5
    Does not hep me. My search works only if the file is directly in the same directory. When I click on the parent directory, search shows no results. – milkovsky Mar 23 '17 at 14:18
  • 6
    Argh. There is a checkbox `Recursively` https://www.reddit.com/r/phpstorm/comments/3ty6ld/phpstorm_10_find_in_path_not_working/ – milkovsky Mar 23 '17 at 14:22
  • 1
    I just had this issue. I tried the fix above to no avail. My double shift was working (searching classes) but searching within a single file, searching an entire directory, etc was broken. I deleted all phpstorm files for the program and re-copied them over and it fixed it. This was after upgrading to 2017.1.2 – Skylord123 Apr 24 '17 at 16:36
  • I was afraid this was going to clear my local changes from git somehow - it did not. Works perfectly. – VSO Aug 02 '17 at 18:16
  • 1
    What @milkovsky said! I just had this exact same issue. Mind that the checkbox seems to be a UI button now, see http://imgur.com/a/CWyxz – Dominik Ehrenberg Aug 08 '17 at 07:04
  • This also fixed my PyCharm search (Find in Path) when it stopped returning results for stuff I knew existed. – dgundersen Oct 03 '17 at 19:05
  • So this works, but I have to do it multiple times a day... what would be causing this? – CWSpear Oct 30 '17 at 15:46
  • Doesn't this reset code alignment, spacing and other similar preferences? – Herbi Shtini Mar 20 '18 at 09:11
  • 1
    Since Version 2020.3 this option is NOT helping anymore. Whatever is regularly corrupting those indexes, they get corrupted also when they are recreated. We will need to wait for a bugfix – John Dec 28 '20 at 02:06
  • that happened to me as well.Now fully realised - I copy pasted a folder manually and it just wasnt indexed by ide as it looks. Came back to this upvoted before post once again. – CodeToLife Apr 18 '21 at 19:09
  • This also helped me 6 years later when PhpStorm was stuck indexing, in a background task: Updating indexes – nbaosullivan Apr 28 '21 at 09:18
25

For me nbaosullivan's proposed solution didn't work.

In my case Recursive(Alt+Y) options wasn't selected. I selected it and it worked and it will be set as default, you don't need to select it all the time.

See that icon and select it please

danronmoon
  • 3,814
  • 5
  • 34
  • 56
16

Try this (it helped me in PhpStorm 2019.3.1 when "Invalidate Caches / Restart" did not):

  1. Close WebStorm

  2. Backup directory <your project>/.idea/ to anywhere

  3. Delete file <your project>/.idea/modules.xml

  4. Open WebStorm

Mihail H.
  • 1,555
  • 16
  • 18
  • in my case there is no file named modules.xml, It has vcs.xml and workspace.xml what should be the approach in this case. – Nipul Sindwani Jan 10 '22 at 12:38
  • Had an issue where the WS seemingly lost current workspace folder? Tests were not running, search not working. Removing the whole `.idea` folder and reopening workspace did indeed help. – Dmitriy May 08 '23 at 11:17
3

Newer version of Webstorm /PHPStorm automatically exclude some folders. For example vendor folder.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000798990-Vendor-directory-being-automatically-excluded

make sure that folders are not excluded

zainengineer
  • 13,289
  • 6
  • 38
  • 28
2

I thought I had this issue but I think actually WebStorm is only returning the first 100 or so results which all happen to be located in 2 files and thus the other occurrences in other files are not shown.

danday74
  • 52,471
  • 49
  • 232
  • 283
  • 1
    Thank you! This is exactly what was happening for me. It just seemed like "Find in Files" didn't work because it missed the instances I was searching for. Limiting the search scope would cause the instances to appear so I knew it wasn't an invalid cache issue. Changing the "Maximum number of results" to 1000 resolved this issue for me. Here's where it can be found: Settings/Preferences => Advanced Settings => Find/Replace – alanning Apr 08 '23 at 02:39
1

For me unchecking the "Words" option (which searches as a whole word) make it work.

alpere
  • 1,079
  • 17
  • 26
1

As an alternative where I needed to refactor the word "holder" with "owner". Using Webstorm's find did not work very well for me. I decided to use instead the the command line with egrep:

egrep -Rli [^place]holder ./src
-R (recursive all files in directory including symbolic links)
-l (file name only)
-i (ignore case)

I found everything and excluded some instances as well via regex. It is way easier and most accurate.

RudyD
  • 667
  • 7
  • 11
1

This is how I fixed the issue:

  1. File
  2. Repair IDE...
  3. (Follow steps to repair indexes)

After doing this, I was able to search "everywhere" using Shift Shift

Kellen Stuart
  • 7,775
  • 7
  • 59
  • 82