Catmandu::Fix::search_in_store(3pm)

NAME
Catmandu::Fix::search_in_store - use the value as query, and replace it by a search object

SYNTAX
search_in_store(path)

search_in_store(path,store: 'store', bag: 'bag', limit: 0, start: 0, sort: 'title desc')

RETURN VALUE
    {
        start: 0,
        limit: 0,
        hits: [],
        total: 1000
    }

cf. Catmandu::Hits

PARAMETERS

  path
The location in the perl hash where the query is stored.

See "PATHS" in Catmandu::Fix for more information about paths.

  store
The name of the store.

This store MUST be an implementation of Catmandu::Searchable.

There are several ways to refer to a store:

    * by full package name ( e.g. 'Catmandu::Store::Solr' )
    * by short package name ( e.g. 'Solr' )
    * by name defined in the Catmandu configuration

See "store-NAME" in Catmandu for more information.

Default is 'default'.

  bag
Name of bag.

Default is 'data'.

  limit
only return $limit number of records.

  start
offset of records to return

  sort
sort records before slicing them.

This parameter is store specific.

OTHER PARAMETERS
other parameters are given to the contructor of the Catmandu::Store

e.g. catmandu.yml:

    store:
        catalog:
            package: "Catmandu::Store::Solr"

e.g. fix:

    search_in_store('foo.query', store:'catalog', bag: 'data', url: 'http://localhost:8983/solr/catalog')

EXAMPLES
    #search in Catmandu->store->bag, and store first 20 results in the foo.query.hits
    search_in_store('foo.query')

    #search in Catmandu->store->bag, and store first 20 results in the foo.query.hits
    search_in_store('foo.query', store:'default')

    #search in Catmandu->store->bag; limit number of results to 10
    search_in_store('foo.query', store:'default', limit: 10)

    #search in Catmandu->store->bag; limit number of result to 10, starting from 15
    search_in_store('foo.query', store:'default', limit: 10, start: 15)

    #search in Catmandu->store->bag('persons'); sort by year descending, and by title ascending
    search_in_store('foo.query', store:'default', bag:'persons', sort: 'year desc,title asc')

AUTHORS
Nicolas Franck "<nicolas.franck at ugent.be>"

SEE ALSO
Catmandu::Fix

Catmandu::Store