Changed common terms query to also support camelCased parameters

and renamed disable_coords to disable_coord, to be consistent with
the bool query

Closes #3074
This commit is contained in:
Clinton Gormley 2013-05-22 16:51:11 +02:00
parent 927fda8a61
commit bb9871bcb5
1 changed files with 10 additions and 10 deletions

View File

@ -98,11 +98,11 @@ public class CommonTermsQueryParser implements QueryParser {
throw new QueryParsingException(parseContext.index(), "[common] analyzer [" + parser.text() + "] not found"); throw new QueryParsingException(parseContext.index(), "[common] analyzer [" + parser.text() + "] not found");
} }
queryAnalyzer = analyzer; queryAnalyzer = analyzer;
} else if ("disable_coords".equals(currentFieldName)) { } else if ("disable_coord".equals(currentFieldName) || "disableCoord".equals(currentFieldName)) {
disableCoords = parser.booleanValue(); disableCoords = parser.booleanValue();
} else if ("boost".equals(currentFieldName)) { } else if ("boost".equals(currentFieldName)) {
boost = parser.floatValue(); boost = parser.floatValue();
} else if ("high_freq_operator".equals(currentFieldName)) { } else if ("high_freq_operator".equals(currentFieldName) || "highFreqOperator".equals(currentFieldName)) {
String op = parser.text(); String op = parser.text();
if ("or".equalsIgnoreCase(op)) { if ("or".equalsIgnoreCase(op)) {
highFreqOccur = BooleanClause.Occur.SHOULD; highFreqOccur = BooleanClause.Occur.SHOULD;
@ -112,7 +112,7 @@ public class CommonTermsQueryParser implements QueryParser {
throw new QueryParsingException(parseContext.index(), throw new QueryParsingException(parseContext.index(),
"[common] query requires operator to be either 'and' or 'or', not [" + op + "]"); "[common] query requires operator to be either 'and' or 'or', not [" + op + "]");
} }
} else if ("low_freq_operator".equals(currentFieldName)) { } else if ("low_freq_operator".equals(currentFieldName) || "lowFreqOperator".equals(currentFieldName)) {
String op = parser.text(); String op = parser.text();
if ("or".equalsIgnoreCase(op)) { if ("or".equalsIgnoreCase(op)) {
lowFreqOccur = BooleanClause.Occur.SHOULD; lowFreqOccur = BooleanClause.Occur.SHOULD;