org.apache.lucene.search.spans

## Class SpanQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.spans.SpanQuery

- Direct Known Subclasses:
    FieldMaskingSpanQuery, SpanBoostQuery, SpanContainingQuery, SpanMultiTermQueryWrapper, SpanNearQuery, SpanNotQuery, SpanOrQuery, SpanPositionCheckQuery, SpanTermQuery, SpanWithinQuery

      public abstract class SpanQuery
      extends Query

  Base class for span-based queries.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpanQuery()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract SpanWeight` | `createWeight(IndexSearcher searcher, boolean needsScores, float boost)` Expert: Constructs an appropriate Weight implementation for this query.
    `abstract String` | `getField()` Returns the name of the field matched by this query.
    `static Map<Term,TermContext>` | `getTermContexts(Collection<SpanWeight> weights)` Build a map of terms to termcontexts, for use in constructing SpanWeights
    `static Map<Term,TermContext>` | `getTermContexts(SpanWeight... weights)` Build a map of terms to termcontexts, for use in constructing SpanWeights

    - ### Methods inherited from class org.apache.lucene.search.Query

      `classHash, equals, hashCode, rewrite, sameClassAs, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SpanQuery

          public SpanQuery()

  - ### Method Detail

    - #### getField

          public abstract String getField()

      Returns the name of the field matched by this query.

    - #### createWeight

          public abstract SpanWeight createWeight(IndexSearcher searcher,
                                                  boolean needsScores,
                                                  float boost)
                                           throws IOException

      Description copied from class: `Query`
      Expert: Constructs an appropriate Weight implementation for this query.

      Only implemented by primitive queries, which re-write to themselves.

      Overrides:
        `createWeight` in class `Query`
        `needsScores` - True if document scores (`Scorer.score()`) are needed.
        `boost` - The boost that is propagated by the parent queries.
      Throws:
        `IOException`

    - #### getTermContexts

          public static Map<Term,TermContext> getTermContexts(SpanWeight... weights)

      Build a map of terms to termcontexts, for use in constructing SpanWeights
      NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

    - #### getTermContexts

          public static Map<Term,TermContext> getTermContexts(Collection<SpanWeight> weights)

      Build a map of terms to termcontexts, for use in constructing SpanWeights
      NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.