org.apache.lucene.search.spans

## Class SpanQuery

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

- All Implemented Interfaces:
    Cloneable
  Direct Known Subclasses:
    FieldMaskingSpanQuery, SpanMultiTermQueryWrapper, SpanNearQuery, SpanNotQuery, SpanOrQuery, SpanPositionCheckQuery, SpanTermQuery

      public abstract class SpanQuery
      extends Query

  Base class for span-based queries.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpanQuery()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher)` Expert: Constructs an appropriate Weight implementation for this query.
    `abstract String` | `getField()` Returns the name of the field matched by this query.
    `abstract Spans` | `getSpans(AtomicReaderContext context, Bits acceptDocs, Map<Term,TermContext> termContexts)` Expert: Returns the matches for this query in an index.

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

      `clone, equals, extractTerms, getBoost, hashCode, rewrite, setBoost, toString, toString`

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

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

- - ### Constructor Detail

    - #### SpanQuery

          public SpanQuery()

  - ### Method Detail

    - #### getSpans

          public abstract Spans getSpans(AtomicReaderContext context,
                       Bits acceptDocs,
                       Map<Term,TermContext> termContexts)
                                  throws IOException

      Expert: Returns the matches for this query in an index. Used internally to search for spans.
      Throws:
        `IOException`

    - #### getField

          public abstract String getField()

      Returns the name of the field matched by this query.

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher)
                              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`
      Throws:
        `IOException`

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