Skip to content

Commit

Permalink
Fix minIDs and maxIDs bug in other FacetDataCache
Browse files Browse the repository at this point in the history
  • Loading branch information
yozhao committed May 15, 2014
1 parent 52b6fb8 commit 27d923b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Expand Up @@ -125,6 +125,19 @@ public void load(String fieldName, AtomicReader reader, TermListFactory<T> listF
}

list.seal();
// Process minIDList and maxIDList for negative number
for (int i = 1; i < negativeValueCount/2 + 1; ++i) {
int top = i;
int tail = negativeValueCount - i + 1;
int topValue = minIDList.getInt(top);
int tailValue = minIDList.getInt(tail);
minIDList.set(top, tailValue);
minIDList.set(tail, topValue);
topValue = maxIDList.getInt(top);
tailValue = maxIDList.getInt(tail);
maxIDList.set(top, tailValue);
maxIDList.set(tail, topValue);
}

try {
_nestedArray.load(maxdoc + 1, loader);
Expand Down Expand Up @@ -229,6 +242,19 @@ public void load(String fieldName, AtomicReader reader, TermListFactory<T> listF
}

list.seal();
// Process minIDList and maxIDList for negative number
for (int i = 1; i < negativeValueCount/2 + 1; ++i) {
int top = i;
int tail = negativeValueCount - i + 1;
int topValue = minIDList.getInt(top);
int tailValue = minIDList.getInt(tail);
minIDList.set(top, tailValue);
minIDList.set(tail, topValue);
topValue = maxIDList.getInt(top);
tailValue = maxIDList.getInt(tail);
maxIDList.set(top, tailValue);
maxIDList.set(tail, topValue);
}

this.valArray = list;
this.freqs = freqList.toIntArray();
Expand Down
Expand Up @@ -133,6 +133,19 @@ public void load(String fieldName, AtomicReader reader, TermListFactory<T> listF
}

list.seal();
// Process minIDList and maxIDList for negative number
for (int i = 1; i < negativeValueCount/2 + 1; ++i) {
int top = i;
int tail = negativeValueCount - i + 1;
int topValue = minIDList.getInt(top);
int tailValue = minIDList.getInt(tail);
minIDList.set(top, tailValue);
minIDList.set(tail, topValue);
topValue = maxIDList.getInt(top);
tailValue = maxIDList.getInt(tail);
maxIDList.set(top, tailValue);
maxIDList.set(tail, topValue);
}

try {
_nestedArray.load(maxdoc + 1, loader);
Expand Down

0 comments on commit 27d923b

Please sign in to comment.