Method: Orchestrate::Client#search

Defined in:
lib/orchestrate/client.rb

#search(collection, query, options = {}) ⇒ Object

Search the items in a collection using a Lucene Query Syntax.

Parameters:

  • collection (#to_s)

    The name of the collection

  • query (String)

    The Lucene Query String to query the collection with.

  • options (Hash) (defaults to: {})

    Parameters for the query

Options Hash (options):

  • :limit (Integer) — default: 10

    The number of results to return. Maximum 100.

  • :offset (Integer) — default: 0

    The starting position of the results.

  • :sort (String)

    The field and direction to sort by. Ex: value.name:asc

Returns:

  • Orchestrate::API::CollectionResponse

Raises:

  • Orchestrate::API::InvalidSearchParam The :limit/:offset values are not valid.

  • Orchestrate::API::SearchQueryMalformed if query isn't a valid Lucene query.


75
76
77
78
# File 'lib/orchestrate/client.rb', line 75

def search(collection, query, options={})
  send_request :get, [collection], { query: options.merge({query: query}),
                                     response: API::CollectionResponse }
end