mirror of https://github.com/apache/lucene.git
LUCENE-3890: Fixed NPE for grouped faceting on multi-valued fields
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1303002 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2544bdd3d
commit
7c4c592e05
|
@ -105,6 +105,9 @@ Bug Fixes
|
|||
* LUCENE-3045: fixed QueryNodeImpl.containsTag(String key) that was
|
||||
not lowercasing the key before checking for the tag (Adriano Crestani)
|
||||
|
||||
* LUCENE-3890: Fixed NPE for grouped faceting on multi-valued fields.
|
||||
(Michael McCandless, Martijn van Groningen)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-3468: Replaced last() and remove() with pollLast() in
|
||||
|
|
|
@ -187,12 +187,14 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
|
||||
public void collect(int doc) throws IOException {
|
||||
int groupOrd = groupFieldTermsIndex.getOrd(doc);
|
||||
if (facetOrdTermsEnum != null) {
|
||||
reuse = facetFieldDocTermOrds.lookup(doc, reuse);
|
||||
}
|
||||
int chunk;
|
||||
boolean first = true;
|
||||
int[] buffer = new int[5];
|
||||
do {
|
||||
chunk = reuse.read(buffer);
|
||||
chunk = reuse != null ? reuse.read(buffer) : 0;
|
||||
if (first && chunk == 0) {
|
||||
chunk = 1;
|
||||
buffer[0] = facetFieldDocTermOrds.numTerms(); // this facet ord is reserved for docs not containing facet field.
|
||||
|
@ -246,7 +248,7 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
|
||||
int facetOrd;
|
||||
if (groupedFacetHit.facetValue != null) {
|
||||
if (!facetOrdTermsEnum.seekExact(groupedFacetHit.facetValue, true)) {
|
||||
if (facetOrdTermsEnum == null || !facetOrdTermsEnum.seekExact(groupedFacetHit.facetValue, true)) {
|
||||
continue;
|
||||
}
|
||||
facetOrd = (int) facetOrdTermsEnum.ord();
|
||||
|
@ -260,7 +262,13 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
}
|
||||
|
||||
if (facetPrefix != null) {
|
||||
TermsEnum.SeekStatus seekStatus = facetOrdTermsEnum.seekCeil(facetPrefix, true);
|
||||
TermsEnum.SeekStatus seekStatus;
|
||||
if (facetOrdTermsEnum != null) {
|
||||
seekStatus = facetOrdTermsEnum.seekCeil(facetPrefix, true);
|
||||
} else {
|
||||
seekStatus = TermsEnum.SeekStatus.END;
|
||||
}
|
||||
|
||||
if (seekStatus != TermsEnum.SeekStatus.END) {
|
||||
startFacetOrd = (int) facetOrdTermsEnum.ord();
|
||||
} else {
|
||||
|
@ -296,9 +304,11 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
|||
endFacetOrd == missingCountIndex + 1 ? missingCountIndex : endFacetOrd);
|
||||
this.tenum = tenum;
|
||||
this.mergePos = startFacetOrd;
|
||||
if (tenum != null) {
|
||||
tenum.seekExact(mergePos);
|
||||
mergeTerm = tenum.term();
|
||||
}
|
||||
}
|
||||
|
||||
protected void nextTerm() throws IOException {
|
||||
mergeTerm = tenum.next();
|
||||
|
|
Loading…
Reference in New Issue