Class | Ferret::Search::MultiTermQuery |
In: |
ext/r_search.c
|
Parent: | Ferret::Search::Query |
MultiTermQuery matches documents that contain one of a list of terms in a specific field. This is the basic building block for queries such as;
MultiTermQuery is very similar to a boolean "Or" query. It is highly optimized though as it focuses on a single field.
multi_term_query = MultiTermQuery.new(:content, :max_term => 10) multi_term_query << "Ruby" << "Ferret" << "Rails" << "Search"
Get the default value for +:max_terms+ in a MultiTermQuery. This value is also used by PrefixQuery, FuzzyQuery and WildcardQuery.
Set the default value for +:max_terms+ in a MultiTermQuery. This value is also used by PrefixQuery, FuzzyQuery and WildcardQuery.
Create a new MultiTermQuery on field field. You will also need to add terms to the query using the MultiTermQuery#add_term method.
There are several options available to you when creating a MultiTermQueries;
:max_terms: | You can specify the maximum number of terms that can be added to the query. This is to prevent memory usage overflow, particularly when don‘t directly control the addition of terms to the Query object like when you create Wildcard queries. For example, searching for "content:*" would cause problems without this limit. |
:min_score: | The minimum score a term must have to be added to the query. For example you could implement your own wild-card queries that gives matches a score. To limit the number of terms added to the query you could set a lower limit to this score. FuzzyQuery in particular makes use of this parameter. |
Add a term to the MultiTermQuery with the score 1.0 unless specified otherwise.
Add a term to the MultiTermQuery with the score 1.0 unless specified otherwise.