In Files

Methods

Class/Module Index [+]

Quicksearch

Ferret::Search::TermQuery

Summary

TermQuery is the most basic query and it is the building block for most other queries. It basically matches documents that contain a specific term in a specific field.

Example

query = TermQuery.new(:content, "rails")

# untokenized fields can also be searched with this query;
query = TermQuery.new(:title, "Shawshank Redemption")

Notice the all lowercase term Rails. This is important as most analyzers will downcase all text added to the index. The title in this case was not tokenized so the case would have been left as is.

Public Class Methods

new(field, term) → term_query click to toggle source

Create a new TermQuery object which will match all documents with the term term in the field field.

Note: As usual, field should be a symbol

static VALUE
frb_tq_init(VALUE self, VALUE rfield, VALUE rterm)
{
    Symbol field = frb_field(rfield);
    char *term = rs2s(rb_obj_as_string(rterm));
    Query *q = tq_new(field, term);
    Frt_Wrap_Struct(self, NULL, &frb_q_free, q);
    object_add(q, self);
    return self;
}

[Validate]

Generated with the Darkfish Rdoc Generator 2.