There was a question today from a
solrium user about switching to the new interface for the
solrium package https://github.com/ropensci/solrium/issues/111
The new version
v1.0 has been out since Nov 2nd https://cran.rstudio.com/web/packages/solrium/
I definitely feel the user’s pain here as it’s very different. We went with a major version bump to
v1.0 to help indicate this, in addition to NEWS items etc. Yet not everyone has a chance to look at release notes, etc.
Here’s a few pointers to help switching to using the new
solr_connectis replaced with
solr_connectwould set connection options, but you wouldn’t do anything with the output of calling it. With
SolrClientyou create a connection object (e.g,.
cli <- SolrClient$new(...)) and
a. call functions on that object (e.g.,
solr_search(cli, ...)), or
b. pass the connection object to a function (e.g.,
The interface (parameters, etc.) is the same whether you use (a) or (b).
- Because you now create a connection object you can now manage connections to many different Solr instances in the same R session.
- To repeat the point, there are two ways to use most functions - Call the function on the connection object or pass the connection object as (usually) the first parameter of a function.
- The query functions (search, facet, group, highlight, mlt, stats, all) now all allow user to do a
POSThttp request. To do a
GETrequest, pass parameters to
paramsand to do a
POSTpass parameters to
body. We’ll take care of the rest. Make sure to set your
qparam if you need it. Since you have to pass a named list with all params to one of
body, the default of
q=*:*is no longer passed if you don’t specify it.
bodydoesn’t have any default values, it’s set to
paramshas a default of
list(q = "*:*")
- There is now an automatic check for
solr_mltto avoid penalty for asking for too many rows. see https://github.com/ropensci/solrium/pull/102
Any other tips I should include here?