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 solrium:
-
solr_connectis replaced withSolrClient.solr_connectwould set connection options, but you wouldn’t do anything with the output of calling it. WithSolrClientyou 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.,cli$search(...))
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
GETorPOSThttp request. To do aGETrequest, pass parameters toparamsand to do aPOSTpass parameters tobody. We’ll take care of the rest. Make sure to set yourqparam if you need it. Since you have to pass a named list with all params to one ofparamsorbody, the default ofq=*:*is no longer passed if you don’t specify it.-
bodydoesn’t have any default values, it’s set toNULL -
paramshas a default oflist(q = "*:*")
-
- There is now an automatic check for
maxRowswith functionssolr_search/solr_all/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?
solrium on github: https://github.com/ropensci/solrium
issues: https://github.com/ropensci/solrium/issues