org.modeshape.search.lucene.query
Class CompareStringQuery

java.lang.Object
  extended by org.apache.lucene.search.Query
      extended by org.modeshape.search.lucene.query.CompareQuery<String>
          extended by org.modeshape.search.lucene.query.CompareStringQuery
All Implemented Interfaces:
Serializable, Cloneable

public class CompareStringQuery
extends CompareQuery<String>

A Lucene Query implementation that is used to apply a Comparison 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 org.apache.lucene.search.Query createQueryForNodesWithFieldEqualTo(String constraintValue, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is equal to the supplied constraint value.
static CompareStringQuery createQueryForNodesWithFieldGreaterThan(String constraintValue, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is greater than the supplied constraint value.
static CompareStringQuery createQueryForNodesWithFieldGreaterThanOrEqualTo(String constraintValue, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is greater than or equal to the supplied constraint value.
static CompareStringQuery createQueryForNodesWithFieldLessThan(String constraintValue, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is less than the supplied constraint value.
static CompareStringQuery createQueryForNodesWithFieldLessThanOrEqualTo(String constraintValue, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is less than or equal to the supplied constraint value.
static org.apache.lucene.search.Query createQueryForNodesWithFieldLike(String likeExpression, String fieldName, ValueFactories factories, boolean caseSensitive)
          Construct a Query implementation that scores documents with a string field value that is LIKE the supplied constraint value.
 
Methods inherited from class org.modeshape.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 org.apache.lucene.search.Query createQueryForNodesWithFieldEqualTo(String constraintValue,
                                                                                 String fieldName,
                                                                                 ValueFactories factories,
                                                                                 boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
Returns:
the query; never null

createQueryForNodesWithFieldGreaterThan

public static CompareStringQuery createQueryForNodesWithFieldGreaterThan(String constraintValue,
                                                                         String fieldName,
                                                                         ValueFactories factories,
                                                                         boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
Returns:
the query; never null

createQueryForNodesWithFieldGreaterThanOrEqualTo

public static CompareStringQuery createQueryForNodesWithFieldGreaterThanOrEqualTo(String constraintValue,
                                                                                  String fieldName,
                                                                                  ValueFactories factories,
                                                                                  boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
Returns:
the query; never null

createQueryForNodesWithFieldLessThan

public static CompareStringQuery createQueryForNodesWithFieldLessThan(String constraintValue,
                                                                      String fieldName,
                                                                      ValueFactories factories,
                                                                      boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
Returns:
the query; never null

createQueryForNodesWithFieldLessThanOrEqualTo

public static CompareStringQuery createQueryForNodesWithFieldLessThanOrEqualTo(String constraintValue,
                                                                               String fieldName,
                                                                               ValueFactories factories,
                                                                               boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
Returns:
the query; never null

createQueryForNodesWithFieldLike

public static org.apache.lucene.search.Query createQueryForNodesWithFieldLike(String likeExpression,
                                                                              String fieldName,
                                                                              ValueFactories factories,
                                                                              boolean caseSensitive)
Construct a Query implementation that scores documents with a string field value that is LIKE the supplied constraint value.

Parameters:
likeExpression - the LIKE expression; 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
caseSensitive - true if the comparison should be done in a case-sensitive manner, or false if it is to be case-insensitive
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.