Class: LogStash::Search::Query
- Inherits:
-
Object
- Object
- LogStash::Search::Query
- Defined in:
- lib/logstash/search/query.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
The max number of results to return.
-
#offset ⇒ Object
The offset to start at (like SQL’s SELECT … OFFSET n).
-
#query_string ⇒ Object
The query string.
Class Method Summary collapse
-
.parse(query_string) ⇒ Object
Class method.
Instance Method Summary collapse
-
#initialize(settings) ⇒ Query
constructor
New query object.
Constructor Details
#initialize(settings) ⇒ Query
New query object.
‘settings’ should be a hash containing:
-
:query_string - a string query for searching
-
:offset - (optional, default 0) offset to search from
-
:count - (optional, default 50) max number of results to return
21 22 23 24 25 |
# File 'lib/logstash/search/query.rb', line 21 def initialize(settings) @query_string = settings[:query_string] @offset = settings[:offset] || 0 @count = settings[:count] || 50 end |
Instance Attribute Details
#count ⇒ Object
The max number of results to return. (like SQL’s SELECT … LIMIT n)
12 13 14 |
# File 'lib/logstash/search/query.rb', line 12 def count @count end |
#offset ⇒ Object
The offset to start at (like SQL’s SELECT … OFFSET n)
9 10 11 |
# File 'lib/logstash/search/query.rb', line 9 def offset @offset end |
#query_string ⇒ Object
The query string
6 7 8 |
# File 'lib/logstash/search/query.rb', line 6 def query_string @query_string end |
Class Method Details
.parse(query_string) ⇒ Object
Class method. Parses a query string and returns a LogStash::Search::Query instance
29 30 31 32 33 |
# File 'lib/logstash/search/query.rb', line 29 def self.parse(query_string) # TODO(sissel): I would prefer not to invent my own query language. # Can we be similar to Lucene, SQL, or other query languages? return self.new(:query_string => query_string) end |