class Ferret::Search::Spans::SpanNotQuery
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.
Public Class Methods
new(include_query, exclude_query) → query
click to toggle source
Create a new SpanNotQuery which matches all
documents which match include_query
and don't match
exclude_query
.
static VALUE frb_spanxq_init(VALUE self, VALUE rinc, VALUE rexc) { Query *q; Check_Type(rinc, T_DATA); Check_Type(rexc, T_DATA); q = spanxq_new(DATA_PTR(rinc), DATA_PTR(rexc)); Frt_Wrap_Struct(self, &frb_spanxq_mark, &frb_q_free, q); object_add(q, self); return self; }