Class | Ferret::Search::Spans::SpanNotQuery |
In: |
ext/r_search.c
|
Parent: | Ferret::Search::Query |
SpanNotQuery is like a BooleanQuery with a +:must_not+ clause. The difference being that the resulting query can be used in another SpanQuery.
Let‘s say you wanted to search for all documents with the term "rails" near the start but without the term "train" near the start. This would allow the term "train" to occur later on in the document.
rails_query = SpanFirstQuery.new(SpanTermQuery.new(:content, "rails"), 100) train_query = SpanFirstQuery.new(SpanTermQuery.new(:content, "train"), 100) query = SpanNotQuery.new(rails_query, train_query)
SpanOrQuery only works with other SpanQueries.
Create a new SpanNotQuery which matches all documents which match include_query and don‘t match exclude_query.