From c68470e57764f9c954008887d302a07a8bf6ae14 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Tue, 22 Oct 2019 15:14:36 +0200 Subject: [PATCH] LUCENE-9022: Never cache GlobalOrdinalsWithScoreQuery (#963) --- lucene/CHANGES.txt | 2 ++ .../lucene/search/join/GlobalOrdinalsWithScoreQuery.java | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 05688250ca4..fe955814f5a 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -64,6 +64,8 @@ Other * LUCENE-8768: Fix Javadocs build in Java 11. (Namgyu Kim) +* LUCENE-8062: GlobalOrdinalsWithScoreQuery is no longer eligible for query caching. (Jim Ferenczi) + ======================= Lucene 8.4.0 ======================= API Changes diff --git a/lucene/join/src/java/org/apache/lucene/search/join/GlobalOrdinalsWithScoreQuery.java b/lucene/join/src/java/org/apache/lucene/search/join/GlobalOrdinalsWithScoreQuery.java index cd1f1f0ee09..183bca19ca9 100644 --- a/lucene/join/src/java/org/apache/lucene/search/join/GlobalOrdinalsWithScoreQuery.java +++ b/lucene/join/src/java/org/apache/lucene/search/join/GlobalOrdinalsWithScoreQuery.java @@ -190,6 +190,13 @@ final class GlobalOrdinalsWithScoreQuery extends Query implements Accountable { } } + @Override + public boolean isCacheable(LeafReaderContext ctx) { + // disable caching because this query relies on a top reader context + // and holds a bitset of matching ordinals that cannot be accounted in + // the memory used by the cache + return false; + } } final static class OrdinalMapScorer extends BaseGlobalOrdinalScorer {