Class: Ferret::Search::Spans::SpanFirstQuery
Summary
A SpanFirstQuery restricts a query to search in the first end bytes of a field. This is useful since often the most important information in a document is at the start of the document.
Example
To find all documents where "ferret" is within the first 100 characters (really bytes);
query = SpanFirstQuery.new(SpanTermQuery.new(:content, "ferret"), 100)
NOTE
SpanFirstQuery only works with other SpanQueries.
Public Class Methods
SpanFirstQuery.new(span_query, end) → query
Create a new SpanFirstQuery which matches all documents where span_query matches before end where end is a byte-offset from the start of the field
/*
* call-seq:
* SpanFirstQuery.new(span_query, end) -> query
*
* Create a new SpanFirstQuery which matches all documents where +span_query+
* matches before +end+ where +end+ is a byte-offset from the start of the
* field
*/
static VALUE
frt_spanfq_init(VALUE self, VALUE rmatch, VALUE rend)
{
Query *q;
Query *match;
Data_Get_Struct(rmatch, Query, match);
q = spanfq_new(match, FIX2INT(rend));
Frt_Wrap_Struct(self, NULL, &frt_q_free, q);
object_add(q, self);
return self;
}