Misbehaving "missing" field in facet results, closes #1070.

This commit is contained in:
kimchy 2011-06-28 12:38:21 +03:00
parent f6ebee3785
commit 4139bb5180
8 changed files with 72 additions and 8 deletions

View File

@ -155,8 +155,16 @@ public class MultiValueByteFieldData extends ByteFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -144,8 +144,16 @@ public class MultiValueDoubleFieldData extends DoubleFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -155,8 +155,16 @@ public class MultiValueFloatFieldData extends FloatFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -155,8 +155,16 @@ public class MultiValueIntFieldData extends IntFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -157,8 +157,16 @@ public class MultiValueLongFieldData extends LongFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -155,8 +155,16 @@ public class MultiValueShortFieldData extends ShortFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -85,8 +85,16 @@ public class MultiValueStringFieldData extends StringFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}

View File

@ -118,8 +118,16 @@ public class MultiValueGeoPointFieldData extends GeoPointFieldData {
}
@Override public void forEachOrdinalInDoc(int docId, OrdinalInDocProc proc) {
boolean found = false;
for (int[] ordinal : ordinals) {
proc.onOrdinal(docId, ordinal[docId]);
int loc = ordinal[docId];
if (loc != 0) {
found = true;
proc.onOrdinal(docId, ordinal[docId]);
}
}
if (!found) {
proc.onOrdinal(docId, 0);
}
}