# NOT RUN {
# start Solr: bin/solr start -f -c -p 8983
# connect
(conn <- SolrClient$new())
# Add documents
file <- system.file("examples", "books2.json", package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_json(files = file, name = "books")
update_json(conn, files = file, name = "books")
# Update commands - can include many varying commands
## Add file
file <- system.file("examples", "updatecommands_add.json",
package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_json(file, "books")
## Delete file
file <- system.file("examples", "updatecommands_delete.json",
package = "solrium")
cat(readLines(file), sep = "\n")
conn$update_json(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")
# }
Run the code above in your browser using DataLab