SolrPromise is a vector-like representation of a deferred
computation within Solr. It may promise to simply return a field, to
perform arithmetic on a combination of fields, to aggregate a field,
etc. Methods on
SolrPromise allow the R user to
manipulate Solr data with the ordinary R API. The typical way to
fulfill a promise is to explicitly coerce the promise to a
materialized data type, such as an R vector.
SolrPromise acts just like an R vector. It supports
all of the basic vector manipulations, including the
Summary group generics, as well
anyNA. All of
these functions are lazy, in that they return another promise.
The promise is really only known to rsolr, as all actual Solr queries
SolrPromise does its best to defer computations, but
the computations will be forced if one performs an operation that is
not supported by Solr.
These functions are also supported, but they are eager:
functions from the
Math group generic are eager:
[<- function will be lazy as long as both
i are promises.
i is assumed to represent a logical
[<- is eager.
SolrPromise also extends the R API with some new operations:
nunique (number of unique elements),
to within a min/max),
This section outlines some limitations of
compared to the base vector implementation. The primary limitation is
that binary operations generally only work between two promises that
derive from the same data source, including all pending manipulations
(filters, ordering, etc). Operations between a promise and an ordinary
vector usually only work if the vector is of length one (a scalar).
Some specific notes:
x[i]: The index
i is ideally a promise. The
return value will be restricted such that it will only combine
with promises with the same restriction.
x %in% table: The
x argument must always
refer to a simple field, and the
table argument should be
either a field, potentially predicated via
i is a promise), or a “short” vector.
grepl(pattern, x, fixed = FALSE): Applies when
x is a promise. Besides
pattern, only the
fixed argument is supported from the base function.
grep(pattern, x, value = FALSE, fixed = FALSE, invert
= FALSE): One must always set
value=TRUE. Beyond that,
invert are supported from the base
cut(x, breaks, include.lowest = FALSE, right = TRUE):
Only supports uniform (constant separation) breaks.
mad(x, center = median(x, na.rm=na.rm), constant =
1.4826, na.rm = FALSE, low = FALSE, high = FALSE): The
high parameters must be
there any NAs, then
na.rm must be
TRUE. Does not
work when the context is grouped.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.