Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

solr_get

Real time get


Description

Get documents by id

Usage

solr_get(conn, ids, name, fl = NULL, wt = "json", raw = FALSE, ...)

Arguments

conn

A solrium connection object, see SolrClient

ids

Document IDs, one or more in a vector or list

name

(character) A collection or core name. Required.

fl

Fields to return, can be a character vector like c('id', 'title'), or a single character vector with one or more comma separated names, like 'id,title'

wt

(character) One of json (default) or xml. Data type returned. If json, uses jsonlite::fromJSON() to parse. If xml, uses xml2::read_xml() to parse.

raw

(logical) If TRUE, returns raw data in format specified by wt param

...

curl options passed on to crul::HttpClient

Details

We use json internally as data interchange format for this function.

Examples

## Not run: 
(cli <- SolrClient$new())

# add some documents first
ss <- list(list(id = 1, price = 100), list(id = 2, price = 500))
add(cli, ss, name = "gettingstarted")

# Now, get documents by id
solr_get(cli, ids = 1, "gettingstarted")
solr_get(cli, ids = 2, "gettingstarted")
solr_get(cli, ids = c(1, 2), "gettingstarted")
solr_get(cli, ids = "1,2", "gettingstarted")

# Get raw JSON
solr_get(cli, ids = 1, "gettingstarted", raw = TRUE, wt = "json")
solr_get(cli, ids = 1, "gettingstarted", raw = TRUE, wt = "xml")

## End(Not run)

solrium

General Purpose R Interface to 'Solr'

v1.1.4
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>), rOpenSci [fnd] (https://ropensci.org/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.