[peter]
authoranna <Anna.Kozlova@jetbrains.com>
Thu, 19 Jan 2012 16:45:52 +0000 (17:45 +0100)
committeranna <Anna.Kozlova@jetbrains.com>
Thu, 19 Jan 2012 16:50:51 +0000 (17:50 +0100)
for multiple words search optimization:
find all ids in the intersection and only then find corresponding vFiles and check scopes, etc
isCheapEnough should not check vFiles at all
IDEA-77297

platform/lang-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java
plugins/properties/src/com/intellij/lang/properties/UnusedPropertyInspection.java
plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferencesSearcher.java

index 2979a78099c6571e03dc1a10dca128aa25c7a1fc..676d3b81ba69a2158064caf63c9aa5422bd9495d 100644 (file)
@@ -28,9 +28,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.roots.FileIndexFacade;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
@@ -46,10 +44,11 @@ import com.intellij.util.CommonProcessors;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.CollectionFactory;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.MultiMap;
 import com.intellij.util.indexing.FileBasedIndex;
 import com.intellij.util.text.StringSearcher;
-import gnu.trove.THashSet;
+import gnu.trove.TIntHashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -352,8 +351,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
         searchContext,
         caseSensitively,
         text,
-        new CommonProcessors.CollectProcessor<VirtualFile>(result),
-        progress
+        new CommonProcessors.CollectProcessor<VirtualFile>(result)
       );
       LOG.assertTrue(success);
       return result;
@@ -364,81 +362,34 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
   }
 
   public boolean processFilesWithText(@NotNull final GlobalSearchScope scope,
-                                       final short searchContext,
-                                       final boolean caseSensitively,
-                                       @NotNull String text,
-                                       @NotNull final Processor<VirtualFile> processor,
-                                       @Nullable ProgressIndicator progress) {
-    List<String> words = StringUtil.getWordsIn(text);
-    if (words.isEmpty()) return true;
-    Collections.sort(words, new Comparator<String>() {
+                                      final short searchContext,
+                                      final boolean caseSensitively,
+                                      @NotNull String text,
+                                      @NotNull final Processor<VirtualFile> processor) {
+    final ArrayList<IdIndexEntry> entries = getWordEntries(text, caseSensitively);
+    if (entries.isEmpty()) return true;
+
+    final Collection<VirtualFile> fileSet = ApplicationManager.getApplication().runReadAction(new Computable<Collection<VirtualFile>>() {
       @Override
-      public int compare(String o1, String o2) {
-        return o2.length() - o1.length();
-      }
-    });
-    final Set<VirtualFile> fileSet;
-    CacheManager cacheManager = CacheManager.SERVICE.getInstance(myManager.getProject());
-
-    if (words.size() > 1) {
-      fileSet = new THashSet<VirtualFile>();
-      Set<VirtualFile> copy = new THashSet<VirtualFile>();
-      for (int i = 0; i < words.size() - 1; i++) {
-        if (progress != null) {
-          progress.checkCanceled();
-        }
-        else {
-          ProgressManager.checkCanceled();
-        }
-        final String word = words.get(i);
-        final int finalI = i;
-        cacheManager.collectVirtualFilesWithWord(new CommonProcessors.CollectProcessor<VirtualFile>(i != 0 ? copy:fileSet) {
+      public Collection<VirtualFile> compute() {
+        final CommonProcessors.CollectProcessor<VirtualFile> collectProcessor = new CommonProcessors.CollectProcessor<VirtualFile>();
+        FileBasedIndex.getInstance().processFilesContainingAllKeys(IdIndex.NAME, entries, scope, new Condition<Integer>() {
           @Override
-          protected boolean accept(VirtualFile virtualFile) {
-            return finalI == 0 || fileSet.contains(virtualFile);
+          public boolean value(Integer integer) {
+            return (integer.intValue() & searchContext) != 0;
           }
-        }, word, searchContext, scope, caseSensitively);
-        if (i != 0) {          
-          fileSet.retainAll(copy);
-        }
-        copy.clear();
-        if (fileSet.isEmpty()) break;
+        }, collectProcessor);
+        return collectProcessor.getResults();
       }
-      if (fileSet.isEmpty()) return true;
-    }
-    else {
-      fileSet = null;
-    }
+    });
 
-    final String lastWord = words.get(words.size() - 1);
-    if (processor instanceof CommonProcessors.CollectProcessor) {
-      final CommonProcessors.CollectProcessor collectProcessor = (CommonProcessors.CollectProcessor)processor;
-      return cacheManager.collectVirtualFilesWithWord(new CommonProcessors.CollectProcessor<VirtualFile>(collectProcessor.getResults()) {
-        @Override
-        public boolean process(VirtualFile virtualFile) {
-          if (fileSet == null || fileSet.contains(virtualFile)) return collectProcessor.process(virtualFile);
-          return true;
-        }
-      }, lastWord, searchContext, scope, caseSensitively);
-    } else {
-      THashSet<VirtualFile> files = new THashSet<VirtualFile>();
-      cacheManager.collectVirtualFilesWithWord(new CommonProcessors.CollectProcessor<VirtualFile>(files) {
-        @Override
-        protected boolean accept(VirtualFile virtualFile) {
-          return fileSet == null || fileSet.contains(virtualFile);
-        }
-      }, lastWord, searchContext, scope, caseSensitively);
-      ReadActionProcessor<VirtualFile> readActionProcessor = new ReadActionProcessor<VirtualFile>() {
-        @Override
-        public boolean processInReadAction(VirtualFile virtualFile) {
-          return processor.process(virtualFile);
-        }
-      };
-      for(VirtualFile file:files) {
-        if (!readActionProcessor.process(file)) return false;
+    final FileIndexFacade index = FileIndexFacade.getInstance(myManager.getProject());
+    return ContainerUtil.process(fileSet, new ReadActionProcessor<VirtualFile>() {
+      @Override
+      public boolean processInReadAction(VirtualFile virtualFile) {
+        return !IndexCacheManagerImpl.shouldBeFound(scope, virtualFile, index) || processor.process(virtualFile);
       }
-      return true;
-    }    
+    });
   }
 
   @Override
@@ -725,31 +676,57 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
                                                                    ProgressIndicator progress) {
     final FileIndexFacade index = FileIndexFacade.getInstance(myManager.getProject());
     final MultiMap<VirtualFile, RequestWithProcessor> result = createMultiMap();
-    for (Set<IdIndexEntry> key : singles.keySet()) {
+    for (final Set<IdIndexEntry> key : singles.keySet()) {
       if (key.isEmpty()) {
         continue;
       }
 
+
       final Collection<RequestWithProcessor> data = singles.get(key);
-      GlobalSearchScope commonScope = uniteScopes(data);
+      final GlobalSearchScope commonScope = uniteScopes(data);
 
-      MultiMap<VirtualFile, RequestWithProcessor> intersection = null;
+      if (key.size() == 1) {
+        result.putAllValues(findFilesWithIndexEntry(key.iterator().next(), index, data, commonScope, progress));
+        continue;
+      }
 
-      boolean first = true;
-      for (IdIndexEntry entry : key) {
-        final MultiMap<VirtualFile, RequestWithProcessor> local = findFilesWithIndexEntry(entry, index, data, commonScope, progress);
-        if (first) {
-          intersection = local;
-          first = false;
+      final Collection<VirtualFile> fileSet = ApplicationManager.getApplication().runReadAction(new Computable<Collection<VirtualFile>>() {
+        @Override
+        public Collection<VirtualFile> compute() {
+          final CommonProcessors.CollectProcessor<VirtualFile> processor = new CommonProcessors.CollectProcessor<VirtualFile>();
+          FileBasedIndex.getInstance().processFilesContainingAllKeys(IdIndex.NAME, key, commonScope, null, processor);
+          return processor.getResults();
         }
-        else {
-          intersection.keySet().retainAll(local.keySet());
-          for (VirtualFile file : intersection.keySet()) {
-            intersection.get(file).retainAll(local.get(file));
-          }
+      });
+      
+      for (final VirtualFile file : fileSet) {
+        if (progress != null) {
+          progress.checkCanceled();
+        }
+        for (final IdIndexEntry entry : key) {
+          ApplicationManager.getApplication().runReadAction(new Runnable() {
+            @Override
+            public void run() {
+              FileBasedIndex.getInstance().processValues(IdIndex.NAME, entry, file, new FileBasedIndex.ValueProcessor<Integer>() {
+                @Override
+                public boolean process(VirtualFile file, Integer value) {
+                  if (IndexCacheManagerImpl.shouldBeFound(commonScope, file, index)) {
+                    int mask = value.intValue();
+                    for (RequestWithProcessor single : data) {
+                      final PsiSearchRequest request = single.request;
+                      if ((mask & request.searchContext) != 0 && ((GlobalSearchScope)request.searchScope).contains(file)) {
+                        result.putValue(file, single);
+                      }
+                    }
+                  }
+                  return true;
+                }
+              }, commonScope);
+              
+            }
+          });
         }
       }
-      result.putAllValues(intersection);
     }
     return result;
   }
@@ -853,24 +830,59 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
 
   @Override
   public SearchCostResult isCheapEnoughToSearch(@NotNull String name,
-                                                @NotNull GlobalSearchScope scope,
+                                                @NotNull final GlobalSearchScope scope,
                                                 @Nullable final PsiFile fileToIgnoreOccurencesIn,
                                                 @Nullable ProgressIndicator progress) {
+    
+    final ArrayList<IdIndexEntry> keys = getWordEntries(name, true);
+    if (keys.isEmpty()) return SearchCostResult.ZERO_OCCURRENCES;
+    
+    final TIntHashSet set = ApplicationManager.getApplication().runReadAction(new NullableComputable<TIntHashSet>() {
+      @Override
+      public TIntHashSet compute() {
+        return FileBasedIndex.getInstance().collectFileIdsContainingAllKeys(IdIndex.NAME, keys, scope, null);
+      }
+    }); 
+
+    if (set == null || set.size() > 1000) {
+      return SearchCostResult.TOO_MANY_OCCURRENCES;
+    }
+
     final AtomicInteger count = new AtomicInteger();
-    if (!processFilesWithText(scope, UsageSearchContext.ANY, true, name, new CommonProcessors.CollectProcessor<VirtualFile> (Collections.<VirtualFile>emptyList()) {
+
+    final FileIndexFacade index = FileIndexFacade.getInstance(myManager.getProject());
+    final Processor<VirtualFile> processor = new Processor<VirtualFile>() {
       private final VirtualFile fileToIgnoreOccurencesInVirtualFile =
-        fileToIgnoreOccurencesIn != null ? fileToIgnoreOccurencesIn.getVirtualFile():null;
+        fileToIgnoreOccurencesIn != null ? fileToIgnoreOccurencesIn.getVirtualFile() : null;
 
       @Override
       public boolean process(VirtualFile file) {
         if (file == fileToIgnoreOccurencesInVirtualFile) return true;
-        int value = count.incrementAndGet();
+        if (!IndexCacheManagerImpl.shouldBeFound(scope, file, index)) return true;
+        final int value = count.incrementAndGet();
         return value < 10;
       }
-    }, progress)) {
+    };
+    final boolean cheap = ApplicationManager.getApplication().runReadAction(new NullableComputable<Boolean>() {
+      @Override
+      public Boolean compute() {
+        return FileBasedIndex.processVirtualFiles(set, scope, processor);
+      }
+    });
+
+    if (!cheap) {
       return SearchCostResult.TOO_MANY_OCCURRENCES;
     }
 
     return count.get() == 0 ? SearchCostResult.ZERO_OCCURRENCES : SearchCostResult.FEW_OCCURRENCES;
   }
+
+  private static ArrayList<IdIndexEntry> getWordEntries(String name, boolean caseSensitively) {
+    List<String> words = StringUtil.getWordsIn(name);
+    final ArrayList<IdIndexEntry> keys = new ArrayList<IdIndexEntry>();
+    for (String word : words) {
+      keys.add(new IdIndexEntry(word, caseSensitively));
+    }
+    return keys;
+  }
 }
index 9b39245a44a6bca94c803b3943f35090b1c5adc5..ced92a753e96862508bd3508c28d421a3815a4a4 100644 (file)
@@ -58,10 +58,7 @@ import com.intellij.psi.impl.source.PsiFileImpl;
 import com.intellij.psi.search.EverythingGlobalScope;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.stubs.SerializationManager;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.CommonProcessors;
-import com.intellij.util.Processor;
-import com.intellij.util.SmartList;
+import com.intellij.util.*;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.containers.ConcurrentHashSet;
 import com.intellij.util.containers.ContainerUtil;
@@ -73,6 +70,7 @@ import com.intellij.util.messages.MessageBus;
 import com.intellij.util.messages.MessageBusConnection;
 import gnu.trove.TIntHashSet;
 import gnu.trove.TIntIterator;
+import gnu.trove.TIntProcedure;
 import gnu.trove.TObjectIntHashMap;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -854,14 +852,16 @@ public class FileBasedIndex implements ApplicationComponent {
   }
 
 
-
-  private <K, V> boolean processValuesImpl(final ID<K, V> indexId, final K dataKey, boolean ensureValueProcessedOnce,
-                                        @Nullable final VirtualFile restrictToFile, ValueProcessor<V> processor,
-                                        final GlobalSearchScope filter) {
+  
+  private <K, V, R> R processExceptions(final ID<K, V> indexId,
+                                        @Nullable final VirtualFile restrictToFile, 
+                                        final GlobalSearchScope filter,
+                                        ThrowableConvertor<UpdatableIndex<K, V, FileContent>, R, StorageException> computable) {
     try {
       final UpdatableIndex<K, V, FileContent> index = getIndex(indexId);
       if (index == null) {
-        return true;
+        return null;
       }
       final Project project = filter.getProject();
       //assert project != null : "GlobalSearchScope#getProject() should be not-null for all index queries";
@@ -869,6 +869,33 @@ public class FileBasedIndex implements ApplicationComponent {
 
       try {
         index.getReadLock().lock();
+        return computable.convert(index);
+      }
+      finally {
+        index.getReadLock().unlock();
+      }
+    }
+    catch (StorageException e) {
+      scheduleRebuild(indexId, e);
+    }
+    catch (RuntimeException e) {
+      final Throwable cause = getCauseToRebuildIndex(e);
+      if (cause != null) {
+        scheduleRebuild(indexId, cause);
+      }
+      else {
+        throw e;
+      }
+    }
+    return null;
+  }
+
+  private <K, V> boolean processValuesImpl(final ID<K, V> indexId, final K dataKey, final boolean ensureValueProcessedOnce,
+                                           @Nullable final VirtualFile restrictToFile, final ValueProcessor<V> processor,
+                                           final GlobalSearchScope filter) {
+    ThrowableConvertor<UpdatableIndex<K, V, FileContent>, Boolean, StorageException> keyProcessor = new ThrowableConvertor<UpdatableIndex<K, V, FileContent>, Boolean, StorageException>() {
+      @Override
+      public Boolean convert(UpdatableIndex<K, V, FileContent> index) throws StorageException {
         final ValueContainer<V> container = index.getData(dataKey);
 
         boolean shouldContinue = true;
@@ -876,7 +903,7 @@ public class FileBasedIndex implements ApplicationComponent {
         if (restrictToFile != null) {
           if (restrictToFile instanceof VirtualFileWithId) {
             final int restrictedFileId = getFileId(restrictToFile);
-            for (final Iterator<V> valueIt = container.getValueIterator(); valueIt.hasNext();) {
+            for (final Iterator<V> valueIt = container.getValueIterator(); valueIt.hasNext(); ) {
               final V value = valueIt.next();
               if (container.isAssociated(value, restrictedFileId)) {
                 shouldContinue = processor.process(restrictToFile, value);
@@ -908,23 +935,79 @@ public class FileBasedIndex implements ApplicationComponent {
         }
         return shouldContinue;
       }
-      finally {
-        index.getReadLock().unlock();
-      }
-    }
-    catch (StorageException e) {
-      scheduleRebuild(indexId, e);
-    }
-    catch (RuntimeException e) {
-      final Throwable cause = getCauseToRebuildIndex(e);
-      if (cause != null) {
-        scheduleRebuild(indexId, cause);
-      }
-      else {
-        throw e;
+    };
+    final Boolean result = processExceptions(indexId, restrictToFile, filter, keyProcessor);
+    return result == null || result.booleanValue();
+  }
+  
+  public <K, V> void processFilesContainingAllKeys(final ID<K, V> indexId,
+                                                      final Collection<K> dataKeys,
+                                                      final GlobalSearchScope filter,
+                                                      @Nullable Condition<V> valueChecker,
+                                                      final Processor<VirtualFile> processor) {
+    final TIntHashSet set = collectFileIdsContainingAllKeys(indexId, dataKeys, filter, valueChecker);
+    if (set != null) {
+      processVirtualFiles(set, filter, processor);
+    }
+  }
+
+  @Nullable 
+  public <K, V> TIntHashSet collectFileIdsContainingAllKeys(final ID<K, V> indexId,
+                                                            final Collection<K> dataKeys,
+                                                            final GlobalSearchScope filter,
+                                                            @Nullable final Condition<V> valueChecker) {
+    final ThrowableConvertor<UpdatableIndex<K, V, FileContent>, TIntHashSet, StorageException> convertor =
+      new ThrowableConvertor<UpdatableIndex<K, V, FileContent>, TIntHashSet, StorageException>() {
+        @Nullable
+        @Override
+        public TIntHashSet convert(UpdatableIndex<K, V, FileContent> index) throws StorageException {
+          TIntHashSet mainIntersection = null;
+
+          for (K dataKey : dataKeys) {
+            ProgressManager.checkCanceled();
+            TIntHashSet copy = new TIntHashSet();
+            final ValueContainer<V> container = index.getData(dataKey);
+
+            for (final Iterator<V> valueIt = container.getValueIterator(); valueIt.hasNext(); ) {
+              final V value = valueIt.next();
+              if (valueChecker != null && !valueChecker.value(value)) {
+                continue;
+              }
+              for (final ValueContainer.IntIterator inputIdsIterator = container.getInputIdsIterator(value); inputIdsIterator.hasNext(); ) {
+                final int id = inputIdsIterator.next();
+                if (mainIntersection == null || mainIntersection.contains(id)) {
+                  copy.add(id);
+                }
+              }
+            }
+
+            mainIntersection = copy;
+            if (mainIntersection.isEmpty()) {
+              return new TIntHashSet();
+            }
+          }
+
+          return mainIntersection;
+        }
+      };
+
+
+    return processExceptions(indexId, null, filter, convertor);
+  }
+
+  public static boolean processVirtualFiles(TIntHashSet ids, final GlobalSearchScope filter, final Processor<VirtualFile> processor) {
+    final PersistentFS fs = (PersistentFS)ManagingFS.getInstance();
+    return ids.forEach(new TIntProcedure() {
+      @Override
+      public boolean execute(int id) {
+        ProgressManager.checkCanceled();
+        VirtualFile file = IndexInfrastructure.findFileByIdIfCached(fs, id);
+        if (file != null && filter.accept(file)) {
+          return processor.process(file);
+        }
+        return true;
       }
-    }
-    return true;
+    });
   }
 
   public static @Nullable Throwable getCauseToRebuildIndex(RuntimeException e) {
index 5ff8142dff13dc77eaab806cde4602994460c421..e6f3a2ab49e5e90a6993f85a5d3a8efc25e039ed 100644 (file)
@@ -70,6 +70,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
   private final MessageBus myEventsBus;
 
   private final Map<String, VirtualFileSystemEntry> myRoots = new HashMap<String, VirtualFileSystemEntry>();
+  private final Map<Integer, VirtualFileSystemEntry> myRootsById = new HashMap<Integer, VirtualFileSystemEntry>();
   private VirtualFileSystemEntry myFakeRoot;
   private final Object INPUT_LOCK = new Object();
 
@@ -770,6 +771,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
 
         if (basePath.length() > 0) {
           myRoots.put(rootUrl, root);
+          myRootsById.put(root.getId(), root);
         }
         else {
           myFakeRoot = root;
@@ -861,10 +863,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
     final int parentId = getParent(id);
     if (parentId == 0) {
       synchronized (LOCK) {
-        for (NewVirtualFile root : myRoots.values()) {
-          if (root.getId() == id) return root;
-        }
-        return null;
+        return myRootsById.get(id);
       }
     }
     else {
@@ -992,6 +991,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
       else {
         synchronized (LOCK) {
           myRoots.remove(file.getUrl());
+          myRootsById.remove(id);
           try {
             FSRecords.deleteRootRecord(id);
           }
index dca886a3727a4f514a6e5eade613e3785b2a1eb3..2d2a48c23244360361cfc64f9735b2fc1cacf3c3 100644 (file)
@@ -24,12 +24,18 @@ import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtil;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.psi.*;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiReference;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.PsiSearchHelper;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.List;
+
 /**
  * @author cdr
  */
@@ -69,7 +75,17 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
 
         String name = property.getName();
         if (name == null) return;
-        PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(name, searchScope, file, original);
+        
+        final List<String> words = StringUtil.getWordsIn(name);
+        if (words.isEmpty()) {
+          return;
+        }
+
+        final String lastWord = words.get(words.size() - 1);
+        PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(lastWord, searchScope, file, original);
+        if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return;
+        
+        cheapEnough = searchHelper.isCheapEnoughToSearch(name, searchScope, file, original);
         if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return;
 
         final PsiReference usage = cheapEnough == PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES ? null :
index 07a7359e4cb2248f4d28ac5c751594d5f2be3308..179f47d57a4723255ff747b3144d4d41baf66ad4 100644 (file)
@@ -252,7 +252,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
         }
       };
       ((PsiSearchHelperImpl)PsiSearchHelper.SERVICE.getInstance(project)).processFilesWithText(
-        scope, UsageSearchContext.IN_PLAIN_TEXT, true, name, collector, null  
+        scope, UsageSearchContext.IN_PLAIN_TEXT, true, name, collector
       );
       
       for (final VirtualFile vfile:collector.getResults()) {