Class: Ferret::Search::Spans::SpanNotQuery

Inherits:
Object
  • Object
show all
Defined in:
ext/r_search.c

Overview

Summary

SpanNotQuery is like a BooleanQuery with a :must_not clause. The difference being that the resulting query can be used in another SpanQuery.

Example

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)

NOTE

SpanOrQuery only works with other SpanQueries.