List of usage examples for org.apache.lucene.queryparser.flexible.core.messages QueryParserMessages UNSUPPORTED_NUMERIC_DATA_TYPE
String UNSUPPORTED_NUMERIC_DATA_TYPE
To view the source code for org.apache.lucene.queryparser.flexible.core.messages QueryParserMessages UNSUPPORTED_NUMERIC_DATA_TYPE.
Click Source Link
From source file:com.sindicetech.siren.qparser.keyword.builders.concise.ConciseNodeNumericRangeQueryNodeBuilder.java
License:Open Source License
@Override protected NodeNumericRangeQuery newNodeNumericRangeQuery(final NumericType numberType, final String field, final int precisionStep, final Number lowerNumber, final Number upperNumber, final boolean minInclusive, final boolean maxInclusive) throws QueryNodeException { if (conf.has(ConciseKeywordQueryConfigHandler.ConciseKeywordConfigurationKeys.ATTRIBUTE)) { final String attribute = conf .get(ConciseKeywordQueryConfigHandler.ConciseKeywordConfigurationKeys.ATTRIBUTE); switch (numberType) { case LONG: return ConciseNodeNumericRangeQuery.newLongRange(field, attribute, precisionStep, (Long) lowerNumber, (Long) upperNumber, minInclusive, maxInclusive); case INT: return ConciseNodeNumericRangeQuery.newIntRange(field, attribute, precisionStep, (Integer) lowerNumber, (Integer) upperNumber, minInclusive, maxInclusive); case FLOAT: return ConciseNodeNumericRangeQuery.newFloatRange(field, attribute, precisionStep, (Float) lowerNumber, (Float) upperNumber, minInclusive, maxInclusive); case DOUBLE: return ConciseNodeNumericRangeQuery.newDoubleRange(field, attribute, precisionStep, (Double) lowerNumber, (Double) upperNumber, minInclusive, maxInclusive); default://from w w w . j a v a 2s.c o m throw new QueryNodeException( new MessageImpl(QueryParserMessages.UNSUPPORTED_NUMERIC_DATA_TYPE, numberType)); } } else { return super.newNodeNumericRangeQuery(numberType, field, precisionStep, lowerNumber, upperNumber, minInclusive, maxInclusive); } }
From source file:com.sindicetech.siren.qparser.keyword.builders.NodeNumericRangeQueryNodeBuilder.java
License:Open Source License
protected NodeNumericRangeQuery newNodeNumericRangeQuery(final NumericType numberType, final String field, final int precisionStep, final Number lowerNumber, final Number upperNumber, final boolean minInclusive, final boolean maxInclusive) throws QueryNodeException { switch (numberType) { case LONG:/*from w ww. jav a 2 s. c om*/ return NodeNumericRangeQuery.newLongRange(field, precisionStep, (Long) lowerNumber, (Long) upperNumber, minInclusive, maxInclusive); case INT: return NodeNumericRangeQuery.newIntRange(field, precisionStep, (Integer) lowerNumber, (Integer) upperNumber, minInclusive, maxInclusive); case FLOAT: return NodeNumericRangeQuery.newFloatRange(field, precisionStep, (Float) lowerNumber, (Float) upperNumber, minInclusive, maxInclusive); case DOUBLE: return NodeNumericRangeQuery.newDoubleRange(field, precisionStep, (Double) lowerNumber, (Double) upperNumber, minInclusive, maxInclusive); default: throw new QueryNodeException( new MessageImpl(QueryParserMessages.UNSUPPORTED_NUMERIC_DATA_TYPE, numberType)); } }
From source file:org.sindice.siren.qparser.keyword.builders.NodeNumericRangeQueryNodeBuilder.java
License:Apache License
public NodeNumericRangeQuery<? extends Number> build(final QueryNode queryNode) throws QueryNodeException { final NodeNumericRangeQueryNode numericRangeNode = (NodeNumericRangeQueryNode) queryNode; final NumericQueryNode lowerNumericNode = numericRangeNode.getLowerBound(); final NumericQueryNode upperNumericNode = numericRangeNode.getUpperBound(); final Number lowerNumber, upperNumber; if (lowerNumericNode != null) { lowerNumber = lowerNumericNode.getValue(); } else {//from w ww . j av a2 s. com lowerNumber = null; } if (upperNumericNode != null) { upperNumber = upperNumericNode.getValue(); } else { upperNumber = null; } final NumericAnalyzer numericAnalyzer = numericRangeNode.getNumericAnalyzer(); final NumericType numberType = numericRangeNode.getNumericType(); final String field = numericRangeNode.getField().toString(); final boolean minInclusive = numericRangeNode.isLowerInclusive(); final boolean maxInclusive = numericRangeNode.isUpperInclusive(); final int precisionStep = numericAnalyzer.getPrecisionStep(); switch (numberType) { case LONG: return NodeNumericRangeQuery.newLongRange(field, precisionStep, (Long) lowerNumber, (Long) upperNumber, minInclusive, maxInclusive); case INT: return NodeNumericRangeQuery.newIntRange(field, precisionStep, (Integer) lowerNumber, (Integer) upperNumber, minInclusive, maxInclusive); case FLOAT: return NodeNumericRangeQuery.newFloatRange(field, precisionStep, (Float) lowerNumber, (Float) upperNumber, minInclusive, maxInclusive); case DOUBLE: return NodeNumericRangeQuery.newDoubleRange(field, precisionStep, (Double) lowerNumber, (Double) upperNumber, minInclusive, maxInclusive); default: throw new QueryNodeException( new MessageImpl(QueryParserMessages.UNSUPPORTED_NUMERIC_DATA_TYPE, numberType)); } }