public class CompareLengthQuery extends CompareQuery<Long>
Query
implementation that is used to apply a Length
constraint against a string field. This query
implementation works by using the weight and scorer
of the wrapped query
to score (and return) only those documents with string fields that satisfy the constraint.CompareQuery.CompareScorer, CompareQuery.CompareWeight, CompareQuery.Evaluator<ValueType>
Modifier and Type | Field and Description |
---|---|
protected static CompareQuery.Evaluator<Long> |
EQUAL_TO |
protected static CompareQuery.Evaluator<Long> |
IS_GREATER_THAN |
protected static CompareQuery.Evaluator<Long> |
IS_GREATER_THAN_OR_EQUAL_TO |
protected static CompareQuery.Evaluator<Long> |
IS_LESS_THAN |
protected static CompareQuery.Evaluator<Long> |
IS_LESS_THAN_OR_EQUAL_TO |
protected static CompareQuery.Evaluator<Long> |
NOT_EQUAL_TO |
constraintValue, evaluator, fieldName, fieldSelector, stringFactory, valueTypeFactory
Modifier | Constructor and Description |
---|---|
protected |
CompareLengthQuery(String fieldName,
Long constraintValue,
ValueFactory<String> stringFactory,
CompareQuery.Evaluator<Long> evaluator)
Construct a
Query implementation that scores nodes according to the supplied comparator. |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
static CompareLengthQuery |
createQueryForNodesWithFieldEqualTo(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is equal to the supplied constraint
value. |
static CompareLengthQuery |
createQueryForNodesWithFieldGreaterThan(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is greater than the supplied
constraint value. |
static CompareLengthQuery |
createQueryForNodesWithFieldGreaterThanOrEqualTo(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is greater than or equal to the
supplied constraint value. |
static CompareLengthQuery |
createQueryForNodesWithFieldLessThan(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is less than the supplied
constraint value. |
static CompareLengthQuery |
createQueryForNodesWithFieldLessThanOrEqualTo(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is less than or equal to the
supplied constraint value. |
static CompareLengthQuery |
createQueryForNodesWithFieldNotEqualTo(Long constraintValue,
String fieldName,
ValueFactories factories)
Construct a
Query implementation that scores documents with a field length that is not equal to the supplied
constraint value. |
protected Long |
readFromDocument(org.apache.lucene.index.IndexReader reader,
int docId) |
createWeight, toString
protected static final CompareQuery.Evaluator<Long> EQUAL_TO
protected static final CompareQuery.Evaluator<Long> NOT_EQUAL_TO
protected static final CompareQuery.Evaluator<Long> IS_LESS_THAN
protected static final CompareQuery.Evaluator<Long> IS_LESS_THAN_OR_EQUAL_TO
protected static final CompareQuery.Evaluator<Long> IS_GREATER_THAN
protected static final CompareQuery.Evaluator<Long> IS_GREATER_THAN_OR_EQUAL_TO
protected CompareLengthQuery(String fieldName, Long constraintValue, ValueFactory<String> stringFactory, CompareQuery.Evaluator<Long> evaluator)
Query
implementation that scores nodes according to the supplied comparator.fieldName
- the name of the document field containing the value; may not be nullconstraintValue
- the constraint value; may not be nullstringFactory
- the string factory that can be used during the scoring; may not be nullevaluator
- the CompareQuery.Evaluator
implementation that returns whether the node path satisfies the
constraint; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldEqualTo(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is equal to the supplied constraint
value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldNotEqualTo(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is not equal to the supplied
constraint value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldGreaterThan(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is greater than the supplied
constraint value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldGreaterThanOrEqualTo(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is greater than or equal to the
supplied constraint value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldLessThan(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is less than the supplied
constraint value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullpublic static CompareLengthQuery createQueryForNodesWithFieldLessThanOrEqualTo(Long constraintValue, String fieldName, ValueFactories factories)
Query
implementation that scores documents with a field length that is less than or equal to the
supplied constraint value.constraintValue
- the constraint value; may not be nullfieldName
- the name of the document field containing the value; may not be nullfactories
- the value factories that can be used during the scoring; may not be nullprotected Long readFromDocument(org.apache.lucene.index.IndexReader reader, int docId) throws IOException
readFromDocument
in class CompareQuery<Long>
IOException
public Object clone()
clone
in class org.apache.lucene.search.Query
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.