SolrSchema object represents the schema of a Solr core.
Not all of the information in the schema is represented; only the
relevant elements are included. The user should not need to interact
with this class very often.
One can infer a
SolrSchema from a data.frame with
deriveSolrSchema and then write it out to a file for use with
name(x): Gets the name of the schema/dataset.
uniqueKey(x): Gets the field that serves as the unique key,
i.e., the document identifier.
fields(x, which): Gets a
object, restricted to the fields indicated by
fieldTypes(x, fields): Gets a
FieldTypeList object, containing the type
definition for each field named in
copyFields(x): Gets the copy field relationships as
It may be convenient for R users to autogenerate a Solr schema from a
prototypical data frame. Note that to harness the full power of Solr,
it pays to get familiar with the details. After deriving a schema with
deriveSolrSchema, save it to the standard XML format with
saveXML. See the vignette for an example.
deriveSolrSchema(x, name, version="1.5", uniqueKey=NULL,
includeVersionField=TRUE): Derives a
SolrSchema from a
data.frame (or data.frame-coercible)
is taken by quoting
x, by default. Specify a unique key
required fields are those that
are not allowed to contain missing/empty values. By default, we
guess that a field is required if it does not contain any NAs or
empty strings (both are the same as far as Solr is
stored arguments name
the fields that should be indexed and stored, respectively (see
Solr docs for details). If
TRUE, the magic
_version_ field is added to the
schema, and Solr will use it to track document versions, which
is needed for certain advanced features and generally recommended.
saveXML(doc, file = NULL, compression = 0, indent = TRUE,
prefix = "<?xml version=\"1.0\"?>\n", doctype = NULL, encoding =
getEncoding(doc), ...): Writes the schema to XML. See
saveXML for more details.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.