Skip to content

Commit

Permalink
Fixing weight and declaring it a s final
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
  • Loading branch information
sandeshkr419 committed Jan 24, 2024
1 parent e4e0b3c commit 851b759
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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;
Expand Down Expand Up @@ -98,7 +99,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr

private final String fieldName;

private Weight weight;
private final Weight weight;
private final GlobalOrdLookupFunction lookupGlobalOrd;
protected final CollectionStrategy collectionStrategy;
protected int segmentsWithSingleValuedOrds = 0;
Expand Down Expand Up @@ -151,16 +152,13 @@ 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
Expand Down

0 comments on commit 851b759

Please sign in to comment.