Package org.apache.lucene.queries.spans

## Class SpanNotQuery

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

-     public final class SpanNotQuery
      extends SpanQuery

  Removes matches which overlap with another SpanQuery or which are within x tokens before or y tokens after another SpanQuery.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `SpanNotQuery.SpanNotWeight` | Creates SpanNotQuery scorer instances

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SpanNotQuery​(SpanQuery include, SpanQuery exclude)` | Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude`.
    `SpanNotQuery​(SpanQuery include, SpanQuery exclude, int dist)` | Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude` within `dist` tokens of `include`.
    `SpanNotQuery​(SpanQuery include, SpanQuery exclude, int pre, int post)` | Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude` within `pre` tokens before or `post` tokens of `include`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SpanWeight` | `createWeight​(IndexSearcher searcher, ScoreMode scoreMode, float boost)` |
    `boolean` | `equals​(Object other)` | Returns true iff `o` is equal to this.
    `SpanQuery` | `getExclude()` | Return the SpanQuery whose matches must not overlap those returned.
    `String` | `getField()` | Returns the name of the field matched by this query.
    `SpanQuery` | `getInclude()` | Return the SpanQuery whose matches are filtered.
    `int` | `hashCode()` |
    `Query` | `rewrite​(IndexSearcher indexSearcher)` |
    `String` | `toString​(String field)` |
    `void` | `visit​(QueryVisitor visitor)` |

    - ### Methods inherited from class org.apache.lucene.queries.spans.SpanQuery

      `getTermStates, getTermStates`

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

      `classHash, rewrite, sameClassAs, toString`

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

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

- - ### Constructor Detail

    - #### SpanNotQuery

          public SpanNotQuery​(SpanQuery include,
                              SpanQuery exclude)

      Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude`.

    - #### SpanNotQuery

          public SpanNotQuery​(SpanQuery include,
                              SpanQuery exclude,
                              int dist)

      Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude` within `dist` tokens of `include`. Inversely, a negative `dist` value may be used to specify a certain amount of allowable overlap.

    - #### SpanNotQuery

          public SpanNotQuery​(SpanQuery include,
                              SpanQuery exclude,
                              int pre,
                              int post)

      Construct a SpanNotQuery matching spans from `include` which have no overlap with spans from `exclude` within `pre` tokens before or `post` tokens of `include`. Inversely, negative values for `pre` and/or `post` allow a certain amount of overlap to occur.

  - ### Method Detail

    - #### getInclude

          public SpanQuery getInclude()

      Return the SpanQuery whose matches are filtered.

    - #### getExclude

          public SpanQuery getExclude()

      Return the SpanQuery whose matches must not overlap those returned.

    - #### getField

          public String getField()

      Description copied from class: `SpanQuery`
      Returns the name of the field matched by this query.
      Specified by:
        `getField` in class `SpanQuery`

    - #### toString

          public String toString​(String field)

      Specified by:
        `toString` in class `Query`

    - #### createWeight

          public SpanWeight createWeight​(IndexSearcher searcher,
                                         ScoreMode scoreMode,
                                         float boost)
                                  throws IOException

      Specified by:
        `createWeight` in class `SpanQuery`
      Throws:
        `IOException`

    - #### rewrite

          public Query rewrite​(IndexSearcher indexSearcher)
                        throws IOException

      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### visit

          public void visit​(QueryVisitor visitor)

      Specified by:
        `visit` in class `Query`

    - #### equals

          public boolean equals​(Object other)

      Returns true iff `o` is equal to this.
      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Query`