Description Usage Arguments Details See Also Examples
Update documents with XML data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
conn |
A solrium connection object, see SolrClient |
files |
Path to a single file to load into Solr |
name |
(character) Name of the core or collection |
commit |
(logical) If |
optimize |
Should index optimization be performed before the method returns.
Default: |
max_segments |
optimizes down to at most this number of segments. Default: 1 |
expunge_deletes |
merge segments with deletes away. Default: |
wait_searcher |
block until a new searcher is opened and registered as the
main query searcher, making the changes visible. Default: |
soft_commit |
perform a soft commit - this will refresh the 'view' of the
index in a more performant manner, but without "on-disk" guarantees.
Default: |
prepare_commit |
The prepareCommit command is an expert-level API that calls Lucene's IndexWriter.prepareCommit(). Not passed by default |
wt |
(character) One of json (default) or xml. If json, uses
|
raw |
(logical) If |
... |
curl options passed on to |
You likely may not be able to run this function against many public Solr services, but should work locally.
Other update:
update_csv()
,
update_json()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ## Not run:
# start Solr: bin/solr start -f -c -p 8983
# connect
(conn <- SolrClient$new())
# create a collection
if (!conn$collection_exists("books")) {
conn$collection_create(name = "books", numShards = 2)
}
# Add documents
file <- system.file("examples", "books.xml", package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_xml(file, "books")
# Update commands - can include many varying commands
## Add files
file <- system.file("examples", "books2_delete.xml", package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_xml(file, "books")
## Delete files
file <- system.file("examples", "updatecommands_delete.xml",
package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_xml(file, "books")
## Add and delete in the same document
## Add a document first, that we can later delete
ss <- list(list(id = 456, name = "cat"))
conn$add(ss, "books")
## Now add a new document, and delete the one we just made
file <- system.file("examples", "add_delete.xml", package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_xml(file, "books")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.