Skip to content

Commit

Permalink
lucene 9.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tarzanek authored and vladak committed Jul 18, 2023
1 parent a47e52c commit ab58547
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ private void maybeRedirectToMatchOffset(int docID, List<String> contextFields)
int subIndex = ReaderUtil.subIndex(docID, leaves);
LeafReaderContext leaf = leaves.get(subIndex);

Query rewritten = query.rewrite(reader);
Query rewritten = query.rewrite(searcher);
Weight weight = rewritten.createWeight(searcher, ScoreMode.COMPLETE_NO_SCORES, 1);
Matches matches = weight.matches(leaf, docID - leaf.docBase); // Adjust docID
if (matches != null && matches != MatchesUtils.MATCH_WITH_NO_TERMS) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
</scm>

<properties>
<lucene.version>9.6.0</lucene.version>
<lucene.version>9.7.0</lucene.version>
<mavenjavadocplugin.version>3.2.0</mavenjavadocplugin.version>
<!-- The following changed syntax from e.g. 1.8 to 11. -->
<compileSource>11</compileSource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ class SuggesterSearcher extends IndexSearcher {

private final int numDocs;

private final IndexSearcher is;

/**
* @param reader reader of the index for which to provide suggestions
* @param resultSize size of the results
*/
SuggesterSearcher(final IndexReader reader, final int resultSize) {
super(reader);
is = new IndexSearcher(reader);
numDocs = reader.numDocs();
this.resultSize = resultSize;
}
Expand All @@ -105,7 +108,7 @@ public List<LookupResultItem> suggest(

try {
if (query != null) {
rewrittenQuery = query.rewrite(getIndexReader());
rewrittenQuery = query.rewrite(is);
}
} catch (IOException e) {
logger.log(Level.WARNING, "Could not rewrite query", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
package org.opengrok.suggest.query;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryVisitor;
import org.opengrok.suggest.query.customized.CustomPhraseQuery;
Expand Down Expand Up @@ -143,8 +143,8 @@ public String toString(final String field) {
}

@Override
public Query rewrite(final IndexReader reader) {
return phraseQuery.rewrite(reader);
public Query rewrite(IndexSearcher indexSearcher) {
return phraseQuery.rewrite(indexSearcher);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.opengrok.suggest.query.customized;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.LeafReaderContext;
Expand Down Expand Up @@ -232,7 +231,7 @@ public String toString(String f) {
}

@Override
public Query rewrite(IndexReader reader) {
public Query rewrite(IndexSearcher indexSearcher) {
if (terms.length == 0) {
return new MatchAllDocsQuery();
}
Expand Down

0 comments on commit ab58547

Please sign in to comment.