Class: Ferret::Search::WildcardQuery

Inherits:
MultiTermQuery show all
Defined in:
lib/ferret/search/wildcard_query.rb

Overview

Implements the wildcard search query. Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character. Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with one of the wildcards * or ?.

See WildcardTermEnum

Instance Attribute Summary

Attributes inherited from MultiTermQuery

#term

Attributes inherited from Query

#boost

Instance Method Summary collapse

Methods inherited from MultiTermQuery

#hash, #rewrite, #to_s

Methods inherited from Query

#combine, #create_weight, #extract_terms, #merge_boolean_queries, #rewrite, #similarity, #to_s, #weight

Constructor Details

#initialize(term) ⇒ WildcardQuery

Returns a new instance of WildcardQuery.



11
12
13
# File 'lib/ferret/search/wildcard_query.rb', line 11

def initialize(term) 
  super(term)
end

Instance Method Details

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
# File 'lib/ferret/search/wildcard_query.rb', line 19

def eql?(o) 
  if o.instance_of?(WildcardQuery)
    return super(o)
  end
  return false
end

#get_term_enum(reader) ⇒ Object



15
16
17
# File 'lib/ferret/search/wildcard_query.rb', line 15

def get_term_enum(reader)
  return WildcardTermEnum.new(reader, @term)
end