Skip to content

Commit

Permalink
Change cacheable to false
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Aug 30, 2024
1 parent 8ae0461 commit fc0af5f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public int count(LeafReaderContext context) throws IOException {

@Override
public boolean isCacheable(LeafReaderContext ctx) {
return true;
return false;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryVisitor;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.Weight;
import org.opensearch.search.internal.SearchContext;

Expand Down Expand Up @@ -42,18 +41,10 @@ public ApproximateQuery getApproximationQuery() {
return approximationQuery;
}

@Override
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
if (resolvedQuery == null) {
throw new IllegalStateException("Cannot create weight without setContext being called");
}
return resolvedQuery.createWeight(searcher, scoreMode, boost);
}

@Override
public final Query rewrite(IndexSearcher indexSearcher) throws IOException {
if (resolvedQuery == null) {
throw new IllegalStateException("Cannot create weight without setContext being called");
throw new IllegalStateException("Cannot rewrite resolved query without setContext being called");
}
return resolvedQuery.rewrite(indexSearcher);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected String toString(int dimension, byte[] value) {
try {
IndexSearcher searcher = new IndexSearcher(reader);
searcher.search(query, 10);
Weight weight = query.createWeight(searcher, ScoreMode.TOP_SCORES, 1.0F);
Weight weight = query.rewrite(searcher).createWeight(searcher, ScoreMode.TOP_SCORES, 1.0F);
Scorer scorer = weight.scorer(reader.leaves().get(0));
assertEquals(
scorer,
Expand Down

0 comments on commit fc0af5f

Please sign in to comment.