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:
Yonik Seeley 2015-10-20 21:05:39 +00:00
parent 5beea1098e
commit c7911f41f5
2 changed files with 5 additions and 5 deletions

View File

@ -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
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();
SimpleOrderedMap<Object> bucket = new SimpleOrderedMap<>();
bucket.add("val", bucketVal);
addStats(bucket, 0);
if (hasSubFacets) {
TermQuery filter = new TermQuery(new Term(freq.field, termCopy));
processSubs(bucket, filter, termSet);
processSubs(bucket, bucketQuery, termSet);
}
// TODO... termSet needs to stick around for streaming sub-facets?

View File

@ -122,10 +122,11 @@ public class UnInvertedField extends DocTermOrds {
final BytesRef term = te.term();
if (te.docFreq() > maxTermDocFreq) {
Term t = new Term(field, term); // this makes a deep copy of the term bytes
TopTerm topTerm = new TopTerm();
topTerm.term = BytesRef.deepCopyOf(term);
topTerm.term = t.bytes();
topTerm.termNum = termNum;
topTerm.termQuery = new TermQuery(new Term(field, topTerm.term));
topTerm.termQuery = new TermQuery(t);
bigTerms.put(topTerm.termNum, topTerm);