From e005a9c911bde4ab92b38b6749d8ad43a87feb33 Mon Sep 17 00:00:00 2001 From: Sandesh Kumar Date: Wed, 24 Jan 2024 16:21:03 -0800 Subject: [PATCH] Revert "Fixing weight and declaring it a s final" This reverts commit 851b7599d4735e910cc9cc37d9ab4eb8176b29a2. Signed-off-by: Sandesh Kumar --- .../bucket/terms/GlobalOrdinalsStringTermsAggregator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java index 7652267c7a2eb..870c6be2e037c 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java @@ -40,7 +40,6 @@ import org.apache.lucene.index.SortedSetDocValues; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; -import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.Weight; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.BytesRef; @@ -99,7 +98,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr private final String fieldName; - private final Weight weight; + private Weight weight; private final GlobalOrdLookupFunction lookupGlobalOrd; protected final CollectionStrategy collectionStrategy; protected int segmentsWithSingleValuedOrds = 0; @@ -152,13 +151,16 @@ public GlobalOrdinalsStringTermsAggregator( }); } this.fieldName = ((ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource).getIndexFieldName(); - this.weight = context.searcher().createWeight(context.query(), ScoreMode.COMPLETE_NO_SCORES, 1f); } String descriptCollectionStrategy() { return collectionStrategy.describe(); } + public void setWeight(Weight weight) { + this.weight = weight; + } + /** Collects term frequencies for a given field from a LeafReaderContext. @param ctx The LeafReaderContext to collect terms from