mirror of https://github.com/apache/lucene.git
LUCENE-6821: remove unnecessary term clones
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1709683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5beea1098e
commit
c7911f41f5
|
@ -1158,15 +1158,14 @@ class FacetFieldProcessorStream extends FacetFieldProcessor implements Closeable
|
||||||
|
|
||||||
// OK, we have a good bucket to return... first get bucket value before moving to next term
|
// OK, we have a good bucket to return... first get bucket value before moving to next term
|
||||||
Object bucketVal = sf.getType().toObject(sf, term);
|
Object bucketVal = sf.getType().toObject(sf, term);
|
||||||
BytesRef termCopy = BytesRef.deepCopyOf(term);
|
TermQuery bucketQuery = hasSubFacets ? new TermQuery(new Term(freq.field, term)) : null;
|
||||||
term = termsEnum.next();
|
term = termsEnum.next();
|
||||||
|
|
||||||
SimpleOrderedMap<Object> bucket = new SimpleOrderedMap<>();
|
SimpleOrderedMap<Object> bucket = new SimpleOrderedMap<>();
|
||||||
bucket.add("val", bucketVal);
|
bucket.add("val", bucketVal);
|
||||||
addStats(bucket, 0);
|
addStats(bucket, 0);
|
||||||
if (hasSubFacets) {
|
if (hasSubFacets) {
|
||||||
TermQuery filter = new TermQuery(new Term(freq.field, termCopy));
|
processSubs(bucket, bucketQuery, termSet);
|
||||||
processSubs(bucket, filter, termSet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO... termSet needs to stick around for streaming sub-facets?
|
// TODO... termSet needs to stick around for streaming sub-facets?
|
||||||
|
|
|
@ -122,10 +122,11 @@ public class UnInvertedField extends DocTermOrds {
|
||||||
final BytesRef term = te.term();
|
final BytesRef term = te.term();
|
||||||
|
|
||||||
if (te.docFreq() > maxTermDocFreq) {
|
if (te.docFreq() > maxTermDocFreq) {
|
||||||
|
Term t = new Term(field, term); // this makes a deep copy of the term bytes
|
||||||
TopTerm topTerm = new TopTerm();
|
TopTerm topTerm = new TopTerm();
|
||||||
topTerm.term = BytesRef.deepCopyOf(term);
|
topTerm.term = t.bytes();
|
||||||
topTerm.termNum = termNum;
|
topTerm.termNum = termNum;
|
||||||
topTerm.termQuery = new TermQuery(new Term(field, topTerm.term));
|
topTerm.termQuery = new TermQuery(t);
|
||||||
|
|
||||||
bigTerms.put(topTerm.termNum, topTerm);
|
bigTerms.put(topTerm.termNum, topTerm);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue