add an option to provide the array of ranges "on" the field name itself

This commit is contained in:
kimchy 2010-08-02 18:09:26 +03:00
parent 99af6df0ea
commit 7719dcd790
1 changed files with 4 additions and 4 deletions

View File

@ -56,6 +56,10 @@ public class RangeFacetCollectorParser implements FacetCollectorParser {
if (token == XContentParser.Token.FIELD_NAME) {
fieldName = parser.currentName();
} else if (token == XContentParser.Token.START_ARRAY) {
if (!"ranges".equals(fieldName)) {
// this is the actual field name, so also update the keyField
keyField = fieldName;
}
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
RangeFacet.Entry entry = new RangeFacet.Entry();
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
@ -77,10 +81,6 @@ public class RangeFacetCollectorParser implements FacetCollectorParser {
}
entries.add(entry);
}
if (!"ranges".equals(fieldName)) {
// this is the actual field name, so also update the keyField
keyField = fieldName;
}
} else if (token == XContentParser.Token.START_OBJECT) {
if ("params".equals(fieldName)) {
params = parser.map();