mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
update StringIndex to be a general test example of InvertedIndex
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package com.intellij.index;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.indexing.*;
|
||||
import com.intellij.util.indexing.impl.BasicIndexId;
|
||||
import com.intellij.util.indexing.impl.IndexStorage;
|
||||
import com.intellij.util.indexing.impl.MapBasedForwardIndex;
|
||||
import com.intellij.util.indexing.impl.MapReduceIndex;
|
||||
@@ -46,11 +48,11 @@ public class StringIndex {
|
||||
final PersistentHashMap<Integer, Collection<String>> inputIndex,
|
||||
boolean failOnRebuildRequest)
|
||||
throws IOException {
|
||||
ID<String, String> id = ID.create(testName + "string_index");
|
||||
BasicIndexId<String, String> id = BasicIndexId.create(testName + "string_index");
|
||||
IndexExtension<String, String, PathContentPair> extension = new IndexExtension<String, String, PathContentPair>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ID<String, String> getName() {
|
||||
public IndexId<String, String> getName() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -77,13 +79,18 @@ public class StringIndex {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
myIndex = new VfsAwareMapReduceIndex<String, String, PathContentPair>(extension, storage, new MapBasedForwardIndex<String, String>(extension) {
|
||||
myIndex = new MapReduceIndex<String, String, PathContentPair>(extension, storage, new MapBasedForwardIndex<String, String>(extension) {
|
||||
@NotNull
|
||||
@Override
|
||||
public PersistentHashMap<Integer, Collection<String>> createMap() throws IOException {
|
||||
return inputIndex;
|
||||
}
|
||||
}) {
|
||||
@Override
|
||||
public void checkCanceled() {
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestRebuild(@NotNull Exception ex) {
|
||||
if (failOnRebuildRequest) {
|
||||
|
||||
Reference in New Issue
Block a user