SolrQuery object represents a query to be sent to a
SolrCore. This is a low-level interface to query
construction but will not be useful to most users. The typical reason
to directly manipulate a query would be to batch more operations than is
possible with the high-level
SolrFrame, e.g., combining
SolrQuery API borrows many of the same verbs from the base R
The typical workflow is to construct a query, perform various
manipulations, and finally retrieve a result by passing the query to a
SolrCore, typically via the
params(x), params(x) <- value: Gets/sets the parameters of
the query, which roughly correspond to the parameters of a Solr
“select” request. The only reason to manipulate the
underlying query parameters is to either initiate a headache or to
do something really tricky with Solr, which implies the former.
subset(x, subset, select, fields, select.from =
character()): Behaves like the base
some extensions. The
fields argument is exclusive with
select, and should be a character vector of field names,
potentially with wildcards. The
gives the names that are filtered by
SolrQuery is not associated with any
thus does not know the field set (in the future, we might use
laziness to avoid this problem).
searchDocs(x, q): Performs a conventional document
search using the query string
q. The main difference to
subset) is that (by default) Solr will order the
result by score, i.e., how well each document matches the query.
Constructs a new
SolrQuery instance. If
non-missing, it is passed to
subset and thus serves as an
The Solr facet component counts documents and calculates statistics on a group-wise basis.
facet(x, by, ..., useNA=FALSE, sort=NULL,
decreasing=FALSE, limit=NA_integer_): Returns a query that will
compute the number of documents in each group, where the
grouping is given as
by, typically a formula, or
NULL for global aggregation. Arguments in ... are
quoted and should be expressions that summarize fields, or
mathematical combinations of fields. The names of the statistics
are taken from the argument names; if a name is omitted, a best
guess is made from the expression. If
TRUE, statistics and counts are computed for the bin
where documents have a missing value for one the grouping
sort is non-NULL, it should name a
statistic by which the results should be sorted. This is mostly
useful in conjunction if a
limit is specified, so that
only the top-N statistics are returned.
The formula should consist of Solr field names, or calls that
evaluate to logical and refer to one or more Solr fields. If the
latter, the results are grouped by
NA for that term. As a special case, a term
can be a call to
cut on any numeric or date field, which
will group by bin.
The Solr grouping component causes results to be returned nested into
groups. The main use case would be to restrict to the first or last N
documents in each group. This functionality is not related to
group(x, by, limit = .Machine$integer.max, offset =
0L, env = emptyenv()): Returns the grouping of
by, which might be a formula, or an
expression that evaluates (within
env) to a factor. The
current sort specification applies within the groups, and any
subsequent sorting applies to the groups themselves, by using
the maximum value within the each group. Only the top
limit documents, starting after the first
are returned from each group. Restricting that limit is probably
the main reason to use this functionality.
These two functions are very low-level; users should almost never need to call these.
translate(x, target, core): Translates the query
into the language of Solr, where
core specifies the
target argument should be
Converts the query into a string to be sent to Solr. Remember to
translate first, if necessary.
SolrFrame, the recommended high-level interface
for interacting with Solr
SolrCore, which gives an example of constructing
and evaluating a query
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.