SearchController: Search Controller

Description Arguments Details Examples

Description

An R6 class to control the gathering, sorting and paging of search results. This class controls a number of SearchSource instances by instantiating them, and triggering new searches. Results are merged together and stored in the controller, with pages returned as needed.

Arguments

sources

a named list of sources. Each source must be a list containing at least solr.url. The first source must be called main_source. To access old solr instances specify solr.api.version.

Details

$new(sources = NULL) starts a new search controller

$set_sources(sources) If sources is provided they are concatenated they are retrieved from rcloud.config (main_source) and .session (gist_sources).

$search(all_sources, start, pagesize, sortby, orderby, ...) Main search interface. Arguments match rcloud.search. If start is not zero it will read from internal cache, otherwise it will call new_search.

$new_search(all_sources, sortby, orderby, ...) This triggers a search on the sources and merges/sorts the results back together into the results internal object.

$build_response(start, pagesize) Build the response to send back to RCloud. This takes the start point and page size and returns the right page from the results.

$get_sources() return the config $get_raw_results() return the results as returned by sources $get_results() return the merged results

Examples

1
2
3
4
5
6
7
## Not run: 
SC <-
SearchController$new(sources = list(
 main_source = list(solr.url = "http://solr:8983/solr/rcloudnotebooks")
))

## End(Not run)

MangoTheCat/rcloud.solr documentation built on May 8, 2019, 3:25 p.m.