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