|
|
03b1234 |
diff --git a/plugins/org.python.pydev.shared_core/.classpath b/plugins/org.python.pydev.shared_core/.classpath
|
|
|
03b1234 |
index a950a36..f8225c6 100644
|
|
|
03b1234 |
--- a/plugins/org.python.pydev.shared_core/.classpath
|
|
|
03b1234 |
+++ b/plugins/org.python.pydev.shared_core/.classpath
|
|
|
03b1234 |
@@ -3,9 +3,9 @@
|
|
|
03b1234 |
<classpathentry kind="src" path="src"/>
|
|
|
03b1234 |
<classpathentry kind="src" path="tests"/>
|
|
|
03b1234 |
<classpathentry exported="true" kind="lib" path="libs/snakeyaml-1.11.jar"/>
|
|
|
03b1234 |
- <classpathentry exported="true" kind="lib" path="libs/lucene-core-5.2.1.jar"/>
|
|
|
03b1234 |
- <classpathentry exported="true" kind="lib" path="libs/lucene-analyzers-common-5.2.1.jar"/>
|
|
|
03b1234 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
|
03b1234 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
|
|
03b1234 |
+ <classpathentry kind="lib" path="libs/lucene-analyzers-common-6.1.0.jar"/>
|
|
|
03b1234 |
+ <classpathentry kind="lib" path="libs/lucene-core-6.1.0.jar"/>
|
|
|
03b1234 |
<classpathentry kind="output" path="bin"/>
|
|
|
03b1234 |
</classpath>
|
|
|
03b1234 |
diff --git a/plugins/org.python.pydev.shared_core/build.properties b/plugins/org.python.pydev.shared_core/build.properties
|
|
|
03b1234 |
index 3af32ce..8af3a06 100644
|
|
|
03b1234 |
--- a/plugins/org.python.pydev.shared_core/build.properties
|
|
|
03b1234 |
+++ b/plugins/org.python.pydev.shared_core/build.properties
|
|
|
03b1234 |
@@ -2,11 +2,11 @@ bin.includes = shared_core.jar,\
|
|
|
03b1234 |
META-INF/,\
|
|
|
03b1234 |
LICENSE.txt,\
|
|
|
03b1234 |
libs/,\
|
|
|
03b1234 |
- libs/lucene-analyzers-common-5.2.1.jar,\
|
|
|
03b1234 |
- libs/lucene-core-5.2.1.jar
|
|
|
03b1234 |
+ libs/lucene-analyzers-common-6.1.0.jar,\
|
|
|
03b1234 |
+ libs/lucene-core-6.1.0.jar
|
|
|
03b1234 |
jars.compile.order = shared_core.jar
|
|
|
03b1234 |
source.shared_core.jar = src/
|
|
|
03b1234 |
output.shared_core.jar = bin/
|
|
|
03b1234 |
jars.extra.classpath = libs/snakeyaml-1.11.jar,\
|
|
|
03b1234 |
- libs/lucene-core-5.1.0.jar,\
|
|
|
03b1234 |
- libs/lucene-analyzers-common-5.1.0.jar
|
|
|
03b1234 |
+ libs/lucene-core-6.1.0.jar,\
|
|
|
03b1234 |
+ libs/lucene-analyzers-common-6.1.0.jar
|
|
|
03b1234 |
diff --git a/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/index/IndexApi.java b/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/index/IndexApi.java
|
|
|
03b1234 |
index 3a3c627..d0b7666 100644
|
|
|
03b1234 |
--- a/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/index/IndexApi.java
|
|
|
03b1234 |
+++ b/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/index/IndexApi.java
|
|
|
03b1234 |
@@ -40,6 +40,7 @@
|
|
|
03b1234 |
import org.apache.lucene.index.Term;
|
|
|
03b1234 |
import org.apache.lucene.search.BooleanClause;
|
|
|
03b1234 |
import org.apache.lucene.search.BooleanQuery;
|
|
|
03b1234 |
+import org.apache.lucene.search.BooleanQuery.Builder;
|
|
|
03b1234 |
import org.apache.lucene.search.IndexSearcher;
|
|
|
03b1234 |
import org.apache.lucene.search.MatchAllDocsQuery;
|
|
|
03b1234 |
import org.apache.lucene.search.Query;
|
|
|
03b1234 |
@@ -108,7 +109,7 @@ public void init(boolean applyAllDeletes) throws IOException {
|
|
|
03b1234 |
}
|
|
|
03b1234 |
|
|
|
03b1234 |
searcherFactory = new SearcherFactory();
|
|
|
03b1234 |
- searchManager = new SearcherManager(writer, applyAllDeletes, searcherFactory);
|
|
|
03b1234 |
+ searchManager = new SearcherManager(writer, applyAllDeletes, false, searcherFactory);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
|
|
|
03b1234 |
public void registerTokenizer(String fieldName, TokenStreamComponents tokenStream) {
|
|
|
03b1234 |
@@ -274,14 +275,14 @@ public SearchResult searchExact(String string, String fieldName, boolean applyAl
|
|
|
03b1234 |
|
|
|
03b1234 |
public SearchResult searchExact(String string, String fieldName, boolean applyAllDeletes, IDocumentsVisitor visitor,
|
|
|
03b1234 |
String... fieldsToLoad)
|
|
|
03b1234 |
- throws IOException {
|
|
|
03b1234 |
+ throws IOException {
|
|
|
03b1234 |
Query query = new TermQuery(new Term(fieldName, string));
|
|
|
03b1234 |
return search(query, applyAllDeletes, visitor, fieldsToLoad);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
|
|
|
03b1234 |
public SearchResult searchWildcard(Set<String> string, String fieldName, boolean applyAllDeletes,
|
|
|
03b1234 |
IDocumentsVisitor visitor, Map<String, String> translateFields, String... fieldsToLoad)
|
|
|
03b1234 |
- throws IOException {
|
|
|
03b1234 |
+ throws IOException {
|
|
|
03b1234 |
OrderedMap<String, Set<String>> fieldNameToValues = new OrderedMap<>();
|
|
|
03b1234 |
fieldNameToValues.put(fieldName, string);
|
|
|
03b1234 |
return searchWildcard(fieldNameToValues, applyAllDeletes, visitor, translateFields, fieldsToLoad);
|
|
|
03b1234 |
@@ -294,11 +295,11 @@ public SearchResult searchWildcard(Set<String> string, String fieldName, boolean
|
|
|
03b1234 |
*/
|
|
|
03b1234 |
public SearchResult searchWildcard(OrderedMap<String, Set<String>> fieldNameToValues, boolean applyAllDeletes,
|
|
|
03b1234 |
IDocumentsVisitor visitor, Map<String, String> translateFields, String... fieldsToLoad)
|
|
|
03b1234 |
- throws IOException {
|
|
|
03b1234 |
- BooleanQuery booleanQuery = new BooleanQuery();
|
|
|
03b1234 |
+ throws IOException {
|
|
|
03b1234 |
+ Builder booleanQueryBuilder = new BooleanQuery.Builder();
|
|
|
03b1234 |
Set<Entry<String, Set<String>>> entrySet = fieldNameToValues.entrySet();
|
|
|
03b1234 |
for (Entry<String, Set<String>> entry : entrySet) {
|
|
|
03b1234 |
- BooleanQuery fieldQuery = new BooleanQuery();
|
|
|
03b1234 |
+ Builder fieldQueryBuilder = new BooleanQuery.Builder();
|
|
|
03b1234 |
String fieldName = entry.getKey();
|
|
|
03b1234 |
if (translateFields != null) {
|
|
|
03b1234 |
String newFieldName = translateFields.get(fieldName);
|
|
|
03b1234 |
@@ -327,28 +328,28 @@ public SearchResult searchWildcard(OrderedMap<String, Set<String>> fieldNameToVa
|
|
|
03b1234 |
if (StringUtils.containsOnlyWildCards(s)) {
|
|
|
03b1234 |
throw new RuntimeException("Unable to create term for searching only wildcards: " + s);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
- fieldQuery.add(new WildcardQuery(new Term(fieldName, s)),
|
|
|
03b1234 |
+ fieldQueryBuilder.add(new WildcardQuery(new Term(fieldName, s)),
|
|
|
03b1234 |
negate ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.SHOULD);
|
|
|
03b1234 |
|
|
|
03b1234 |
} else {
|
|
|
03b1234 |
- fieldQuery.add(new TermQuery(new Term(fieldName, s)),
|
|
|
03b1234 |
+ fieldQueryBuilder.add(new TermQuery(new Term(fieldName, s)),
|
|
|
03b1234 |
negate ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.SHOULD);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
if (!negate) {
|
|
|
03b1234 |
allNegate = false;
|
|
|
03b1234 |
}
|
|
|
03b1234 |
}
|
|
|
03b1234 |
-
|
|
|
03b1234 |
- if (fieldQuery.getClauses().length != 0) {
|
|
|
03b1234 |
+ BooleanQuery transitiveQuery = fieldQueryBuilder.build();
|
|
|
03b1234 |
+ if (transitiveQuery.clauses().size() != 0) {
|
|
|
03b1234 |
if (allNegate) {
|
|
|
03b1234 |
// If all are negations, we actually have to add one which would
|
|
|
03b1234 |
// match all to remove the negations.
|
|
|
03b1234 |
- fieldQuery.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
|
|
|
03b1234 |
+ fieldQueryBuilder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
- booleanQuery.add(fieldQuery, BooleanClause.Occur.MUST);
|
|
|
03b1234 |
+ booleanQueryBuilder.add(fieldQueryBuilder.build(), BooleanClause.Occur.MUST);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
}
|
|
|
03b1234 |
-
|
|
|
03b1234 |
+ BooleanQuery booleanQuery = booleanQueryBuilder.build();
|
|
|
03b1234 |
if (DEBUG) {
|
|
|
03b1234 |
System.out.println("Searching: " + booleanQuery);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
@@ -396,7 +397,7 @@ public int getDocId() {
|
|
|
03b1234 |
*/
|
|
|
03b1234 |
public void visitAllDocs(IDocumentsVisitor visitor, String... fields) throws IOException {
|
|
|
03b1234 |
boolean applyAllDeletes = true;
|
|
|
03b1234 |
- try (IndexReader reader = DirectoryReader.open(writer, applyAllDeletes);) {
|
|
|
03b1234 |
+ try (IndexReader reader = DirectoryReader.open(writer, applyAllDeletes, false);) {
|
|
|
03b1234 |
|
|
|
03b1234 |
IndexSearcher searcher = searcherFactory.newSearcher(reader, null);
|
|
|
03b1234 |
Query query = new MatchAllDocsQuery();
|
|
|
03b1234 |
@@ -420,7 +421,7 @@ public SearchResult search(Query query, boolean applyAllDeletes, IDocumentsVisit
|
|
|
03b1234 |
} catch (Exception e) {
|
|
|
03b1234 |
Log.log(e);
|
|
|
03b1234 |
}
|
|
|
03b1234 |
- try (IndexReader reader = DirectoryReader.open(writer, applyAllDeletes);) {
|
|
|
03b1234 |
+ try (IndexReader reader = DirectoryReader.open(writer, applyAllDeletes, false);) {
|
|
|
03b1234 |
IndexSearcher searcher = searcherFactory.newSearcher(reader, null);
|
|
|
03b1234 |
|
|
|
03b1234 |
TopDocs search = searcher.search(query, maxMatches);
|