Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.lucene
Class CompareQuery<ValueType>

    java.lang.Object
      org.apache.lucene.search.Query
          org.modeshape.jcr.query.lucene.CompareQuery<ValueType>

Type Parameters:
  `ValueType` -

All Implemented Interfaces:
  Serializable, Cloneable

Direct Known Subclasses:
  CompareLengthQuery, CompareNameQuery, ComparePathQuery, CompareStringQuery

    public abstract class CompareQuery<ValueType>

extends org.apache.lucene.search.Query

A Lucene `Query` implementation that is used to apply a `Comparison` constraint against the Path of nodes. This query implementation works by using the weight and `scorer` of the wrapped query to score (and return) only those documents that correspond to nodes with Paths that satisfy the constraint.

See Also:
  Serialized Form

Nested Class Summary
`protected class` | `CompareQuery.CompareScorer` A scorer for the Path query.
`protected class` | `CompareQuery.CompareWeight` Calculates query weights and builds query scores for our NOT queries.
`protected static interface` | `CompareQuery.Evaluator<ValueType>`

Field Summary
`protected ValueType` | `constraintValue`
`protected CompareQuery.Evaluator<ValueType>` | `evaluator`
`protected String` | `fieldName` The operand that is being negated by this query.
`protected org.apache.lucene.document.FieldSelector` | `fieldSelector`
`protected ValueFactory<String>` | `stringFactory`
`protected ValueFactory<ValueType>` | `valueTypeFactory`

Constructor Summary
`protected` | `CompareQuery(String fieldName, ValueType constraintValue, ValueFactory<ValueType> valueTypeFactory, ValueFactory<String> stringFactory, CompareQuery.Evaluator<ValueType> evaluator)` Construct a `Query` implementation that scores nodes according to the supplied comparator.
`protected` | `CompareQuery(String fieldName, ValueType constraintValue, ValueFactory<ValueType> valueTypeFactory, ValueFactory<String> stringFactory, CompareQuery.Evaluator<ValueType> evaluator, org.apache.lucene.document.FieldSelector fieldSelector)` Construct a `Query` implementation that scores nodes according to the supplied comparator.

Method Summary
`org.apache.lucene.search.Weight` | `createWeight(org.apache.lucene.search.Searcher searcher)`
`protected ValueType` | `readFromDocument(org.apache.lucene.index.IndexReader reader, int docId)`
`String` | `toString(String field)`

Methods inherited from class org.apache.lucene.search.Query
`clone, combine, equals, extractTerms, getBoost, getSimilarity, hashCode, mergeBooleanQueries, rewrite, setBoost, toString, weight`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### fieldName

    protected final String fieldName

  The operand that is being negated by this query.

### fieldSelector

    protected final org.apache.lucene.document.FieldSelector fieldSelector

### constraintValue

    protected final ValueType constraintValue

### evaluator

    protected final CompareQuery.Evaluator<ValueType> evaluator

### valueTypeFactory

    protected final ValueFactory<ValueType> valueTypeFactory

### stringFactory

    protected final ValueFactory<String> stringFactory

Constructor Detail

### CompareQuery

    protected CompareQuery(String fieldName,
                           ValueType constraintValue,
                           ValueFactory<ValueType> valueTypeFactory,
                           ValueFactory<String> stringFactory,
                           CompareQuery.Evaluator<ValueType> evaluator)

  Construct a `Query` implementation that scores nodes according to the supplied comparator.

  Parameters:
    `fieldName` - the name of the document field containing the value; may not be null
    `constraintValue` - the constraint value; may not be null
    `valueTypeFactory` - the value factory that can be used during the scoring; may not be null
    `stringFactory` - the string factory that can be used during the scoring; may not be null
    `evaluator` - the `CompareQuery.Evaluator` implementation that returns whether the node value satisfies the constraint; may not be null

### CompareQuery

    protected CompareQuery(String fieldName,
                           ValueType constraintValue,
                           ValueFactory<ValueType> valueTypeFactory,
                           ValueFactory<String> stringFactory,
                           CompareQuery.Evaluator<ValueType> evaluator,
                           org.apache.lucene.document.FieldSelector fieldSelector)

  Construct a `Query` implementation that scores nodes according to the supplied comparator.

  Parameters:
    `fieldName` - the name of the document field containing the value; may not be null
    `constraintValue` - the constraint value; may not be null
    `valueTypeFactory` - the value factory that can be used during the scoring; may not be null unless `readFromDocument(IndexReader, int)` is overloaded to not use it
    `stringFactory` - the string factory that can be used during the scoring; may not be null
    `evaluator` - the `CompareQuery.Evaluator` implementation that returns whether the node value satisfies the constraint; may not be null
    `fieldSelector` - the field selector that should load the fields needed to recover the value; may be null if the field selector should be generated automatically

Method Detail

### readFromDocument

    protected ValueType readFromDocument(org.apache.lucene.index.IndexReader reader,
                                         int docId)
                                  throws IOException

  Throws:
    `IOException`

### createWeight

    public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.Searcher searcher)

  Overrides:
    `createWeight` in class `org.apache.lucene.search.Query`
  See Also:
    `Query.createWeight(org.apache.lucene.search.Searcher)`

### toString

    public String toString(String field)

  Specified by:
    `toString` in class `org.apache.lucene.search.Query`
  See Also:
    `Query.toString(java.lang.String)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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