SOLR-5027: Added error handling to CollapsingQParserPlugin

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1535614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joel Bernstein 2013-10-25 02:50:34 +00:00
parent a76227707d
commit 929c88c78f
1 changed files with 4 additions and 0 deletions

View File

@ -188,6 +188,8 @@ public class CollapsingQParserPlugin extends QParserPlugin {
this.nullPolicy = NULL_POLICY_COLLAPSE;
} else if(nPolicy.equals((NULL_EXPAND))) {
this.nullPolicy = NULL_POLICY_EXPAND;
} else {
throw new IOException("Invalid nullPolicy:"+nPolicy);
}
this.searcher = request.getSearcher();
this.leafCount = searcher.getTopReaderContext().leaves().size();
@ -516,6 +518,8 @@ public class CollapsingQParserPlugin extends QParserPlugin {
this.fieldValueCollapse = new LongValueCollapse(searcher, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
} else if(fieldType instanceof TrieFloatField) {
this.fieldValueCollapse = new FloatValueCollapse(searcher, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
} else {
throw new IOException("min/max must be either TrieInt, TrieLong or TrieFloat.");
}
}