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_connect
is replaced withSolrClient
.solr_connect
would set connection options, but you wouldn’t do anything with the output of calling it. WithSolrClient
you 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
GET
orPOST
http request. To do aGET
request, pass parameters toparams
and to do aPOST
pass parameters tobody
. We’ll take care of the rest. Make sure to set yourq
param if you need it. Since you have to pass a named list with all params to one ofparams
orbody
, the default ofq=*:*
is no longer passed if you don’t specify it.-
body
doesn’t have any default values, it’s set toNULL
-
params
has a default oflist(q = "*:*")
-
- There is now an automatic check for
maxRows
with functionssolr_search
/solr_all
/solr_mlt
to 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