fix for SOLR-5039, admin/schema browser displaying -1 for unique terms on multiValued fields

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1502959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2013-07-14 11:41:45 +00:00
parent 1a425dc577
commit 5513f48c87
2 changed files with 3 additions and 1 deletions

View File

@ -468,6 +468,8 @@ Bug Fixes
* SOLR-4744: Update failure on sub shard is not propagated to clients by parent * SOLR-4744: Update failure on sub shard is not propagated to clients by parent
shard (Anshum Gupta, yonik, shalin) shard (Anshum Gupta, yonik, shalin)
* SOLR-5039: Admin/Schema Browser displays -1 for term counts for multiValued fields.
Other Changes Other Changes
---------------------- ----------------------

View File

@ -596,13 +596,13 @@ public class LukeRequestHandler extends RequestHandlerBase
BytesRef text; BytesRef text;
int[] buckets = new int[HIST_ARRAY_SIZE]; int[] buckets = new int[HIST_ARRAY_SIZE];
while ((text = termsEnum.next()) != null) { while ((text = termsEnum.next()) != null) {
++tiq.distinctTerms;
int freq = termsEnum.docFreq(); // This calculation seems odd, but it gives the same results as it used to. int freq = termsEnum.docFreq(); // This calculation seems odd, but it gives the same results as it used to.
int slot = 32 - Integer.numberOfLeadingZeros(Math.max(0, freq - 1)); int slot = 32 - Integer.numberOfLeadingZeros(Math.max(0, freq - 1));
buckets[slot] = buckets[slot] + 1; buckets[slot] = buckets[slot] + 1;
if (freq > tiq.minFreq) { if (freq > tiq.minFreq) {
UnicodeUtil.UTF8toUTF16(text, spare); UnicodeUtil.UTF8toUTF16(text, spare);
String t = spare.toString(); String t = spare.toString();
tiq.distinctTerms = new Long(terms.size()).intValue();
tiq.add(new TopTermQueue.TermInfo(new Term(field, t), termsEnum.docFreq())); tiq.add(new TopTermQueue.TermInfo(new Term(field, t), termsEnum.docFreq()));
if (tiq.size() > numTerms) { // if tiq full if (tiq.size() > numTerms) { // if tiq full