org.jboss.dna.search.lucene.query
Class CompareLengthQuery

java.lang.Object
  extended by org.apache.lucene.search.Query
      extended by org.jboss.dna.search.lucene.query.CompareQuery<Integer>
          extended by org.jboss.dna.search.lucene.query.CompareLengthQuery
All Implemented Interfaces:
Serializable, Cloneable

public class CompareLengthQuery
extends CompareQuery<Integer>

A Lucene 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.

See Also:
Serialized Form

Method Summary
 Object clone()
          
static CompareLengthQuery createQueryForNodesWithFieldEqualTo(Integer 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(Integer 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(Integer 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(Integer 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(Integer 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(Integer 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.
 
Methods inherited from class org.jboss.dna.search.lucene.query.CompareQuery
createWeight, toString
 
Methods inherited from class org.apache.lucene.search.Query
combine, equals, extractTerms, getBoost, getSimilarity, hashCode, mergeBooleanQueries, rewrite, setBoost, toString, weight
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createQueryForNodesWithFieldEqualTo

public static CompareLengthQuery createQueryForNodesWithFieldEqualTo(Integer constraintValue,
                                                                     String fieldName,
                                                                     ValueFactories factories)
Construct a Query implementation that scores documents with a field length that is equal to the supplied constraint value.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

createQueryForNodesWithFieldNotEqualTo

public static CompareLengthQuery createQueryForNodesWithFieldNotEqualTo(Integer 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.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

createQueryForNodesWithFieldGreaterThan

public static CompareLengthQuery createQueryForNodesWithFieldGreaterThan(Integer constraintValue,
                                                                         String fieldName,
                                                                         ValueFactories factories)
Construct a Query implementation that scores documents with a field length that is greater than the supplied constraint value.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

createQueryForNodesWithFieldGreaterThanOrEqualTo

public static CompareLengthQuery createQueryForNodesWithFieldGreaterThanOrEqualTo(Integer 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.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

createQueryForNodesWithFieldLessThan

public static CompareLengthQuery createQueryForNodesWithFieldLessThan(Integer constraintValue,
                                                                      String fieldName,
                                                                      ValueFactories factories)
Construct a Query implementation that scores documents with a field length that is less than the supplied constraint value.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

createQueryForNodesWithFieldLessThanOrEqualTo

public static CompareLengthQuery createQueryForNodesWithFieldLessThanOrEqualTo(Integer 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.

Parameters:
constraintValue - the constraint value; may not be null
fieldName - the name of the document field containing the value; may not be null
factories - the value factories that can be used during the scoring; may not be null
Returns:
the query; never null

clone

public Object clone()

Overrides:
clone in class org.apache.lucene.search.Query
See Also:
Query.clone()


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.