Class: Couchbase::SearchQuery::TermQuery
- Inherits:
-
SearchQuery
- Object
- SearchQuery
- Couchbase::SearchQuery::TermQuery
- Defined in:
- lib/couchbase/search_options.rb
Overview
A query that looks for exact matches of the term in the index (no analyzer, no stemming). Useful to check what the actual
content of the index is. It can also apply fuzziness on the term. Usual better alternative is MatchQuery.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(term) {|self| ... } ⇒ TermQuery
constructor
A new instance of TermQuery.
- #to_h ⇒ Hash<Symbol, #to_json>
Constructor Details
#initialize(term) {|self| ... } ⇒ TermQuery
Returns a new instance of TermQuery.
908 909 910 911 912 |
# File 'lib/couchbase/search_options.rb', line 908 def initialize(term) super() @term = term yield self if block_given? end |
Instance Attribute Details
#boost ⇒ Float
894 895 896 |
# File 'lib/couchbase/search_options.rb', line 894 def boost @boost end |
#field ⇒ String
897 898 899 |
# File 'lib/couchbase/search_options.rb', line 897 def field @field end |
#fuzziness ⇒ Integer
900 901 902 |
# File 'lib/couchbase/search_options.rb', line 900 def fuzziness @fuzziness end |
#prefix_length ⇒ Integer
903 904 905 |
# File 'lib/couchbase/search_options.rb', line 903 def prefix_length @prefix_length end |
Instance Method Details
#to_h ⇒ Hash<Symbol, #to_json>
915 916 917 918 919 920 921 922 923 924 |
# File 'lib/couchbase/search_options.rb', line 915 def to_h data = {:term => @term} data[:boost] = boost if boost data[:field] = field if field if fuzziness data[:fuzziness] = fuzziness data[:prefix_length] = prefix_length if prefix_length end data end |