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
|
* LUCENE-3045: fixed QueryNodeImpl.containsTag(String key) that was
|
||||||
not lowercasing the key before checking for the tag (Adriano Crestani)
|
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
|
Optimizations
|
||||||
|
|
||||||
* LUCENE-3468: Replaced last() and remove() with pollLast() in
|
* 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 {
|
public void collect(int doc) throws IOException {
|
||||||
int groupOrd = groupFieldTermsIndex.getOrd(doc);
|
int groupOrd = groupFieldTermsIndex.getOrd(doc);
|
||||||
reuse = facetFieldDocTermOrds.lookup(doc, reuse);
|
if (facetOrdTermsEnum != null) {
|
||||||
|
reuse = facetFieldDocTermOrds.lookup(doc, reuse);
|
||||||
|
}
|
||||||
int chunk;
|
int chunk;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
int[] buffer = new int[5];
|
int[] buffer = new int[5];
|
||||||
do {
|
do {
|
||||||
chunk = reuse.read(buffer);
|
chunk = reuse != null ? reuse.read(buffer) : 0;
|
||||||
if (first && chunk == 0) {
|
if (first && chunk == 0) {
|
||||||
chunk = 1;
|
chunk = 1;
|
||||||
buffer[0] = facetFieldDocTermOrds.numTerms(); // this facet ord is reserved for docs not containing facet field.
|
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;
|
int facetOrd;
|
||||||
if (groupedFacetHit.facetValue != null) {
|
if (groupedFacetHit.facetValue != null) {
|
||||||
if (!facetOrdTermsEnum.seekExact(groupedFacetHit.facetValue, true)) {
|
if (facetOrdTermsEnum == null || !facetOrdTermsEnum.seekExact(groupedFacetHit.facetValue, true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
facetOrd = (int) facetOrdTermsEnum.ord();
|
facetOrd = (int) facetOrdTermsEnum.ord();
|
||||||
|
@ -260,7 +262,13 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
||||||
}
|
}
|
||||||
|
|
||||||
if (facetPrefix != null) {
|
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) {
|
if (seekStatus != TermsEnum.SeekStatus.END) {
|
||||||
startFacetOrd = (int) facetOrdTermsEnum.ord();
|
startFacetOrd = (int) facetOrdTermsEnum.ord();
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,8 +304,10 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
|
||||||
endFacetOrd == missingCountIndex + 1 ? missingCountIndex : endFacetOrd);
|
endFacetOrd == missingCountIndex + 1 ? missingCountIndex : endFacetOrd);
|
||||||
this.tenum = tenum;
|
this.tenum = tenum;
|
||||||
this.mergePos = startFacetOrd;
|
this.mergePos = startFacetOrd;
|
||||||
tenum.seekExact(mergePos);
|
if (tenum != null) {
|
||||||
mergeTerm = tenum.term();
|
tenum.seekExact(mergePos);
|
||||||
|
mergeTerm = tenum.term();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void nextTerm() throws IOException {
|
protected void nextTerm() throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue