Class: Riak::Search::Query

Inherits:
Object show all
Defined in:
lib/riak/search/query.rb

Overview

A Query wraps a Solr query for Riak Search 2.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, index, term, options = { }) ⇒ Query

Initializes a query object.



54
55
56
57
58
59
60
61
62
# File 'lib/riak/search/query.rb', line 54

def initialize(client, index, term, options = {  })
  @client = client
  validate_index index
  @term = term
  @options = options.symbolize_keys

  set_defaults
  consume_options
end

Instance Attribute Details

#clientRiak::Client (readonly)



45
46
47
# File 'lib/riak/search/query.rb', line 45

def client
  @client
end

#dfArray<String>



25
26
27
# File 'lib/riak/search/query.rb', line 25

def df
  @df
end

#filterString



21
22
23
# File 'lib/riak/search/query.rb', line 21

def filter
  @filter
end

#flArray<String>



33
34
35
# File 'lib/riak/search/query.rb', line 33

def fl
  @fl
end

#indexRiak::Search::Index (readonly)



41
42
43
# File 'lib/riak/search/query.rb', line 41

def index
  @index
end

#opString



29
30
31
# File 'lib/riak/search/query.rb', line 29

def op
  @op
end

#rowsNumeric



9
10
11
# File 'lib/riak/search/query.rb', line 9

def rows
  @rows
end

#sortString



17
18
19
# File 'lib/riak/search/query.rb', line 17

def sort
  @sort
end

#startNumeric



13
14
15
# File 'lib/riak/search/query.rb', line 13

def start
  @start
end

#termString (readonly)



37
38
39
# File 'lib/riak/search/query.rb', line 37

def term
  @term
end

Instance Method Details

#resultsRiak::Search::ResultCollection

Get results from the query. Performs the query when called the first time.



67
68
69
70
71
# File 'lib/riak/search/query.rb', line 67

def results
  return @results if defined? @results

  @results = ResultCollection.new @client, raw_results
end