Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

delete

Delete documents by ID or query


Description

Delete documents by ID or query

Usage

delete_by_id(conn, ids, name, commit = TRUE, commit_within = NULL,
  overwrite = TRUE, boost = NULL, wt = "json", raw = FALSE, ...)

delete_by_query(conn, query, name, commit = TRUE, commit_within = NULL,
  overwrite = TRUE, boost = NULL, wt = "json", raw = FALSE, ...)

Arguments

conn

A solrium connection object, see SolrClient

ids

Document IDs, one or more in a vector or list

name

(character) A collection or core name. Required.

commit

(logical) If TRUE, documents immediately searchable. Deafult: TRUE

commit_within

(numeric) Milliseconds to commit the change, the document will be added within that time. Default: NULL

overwrite

(logical) Overwrite documents with matching keys. Default: TRUE

boost

(numeric) Boost factor. Default: NULL

wt

(character) One of json (default) or xml. If json, uses jsonlite::fromJSON() to parse. If xml, uses xml2::read_xml() to parse

raw

(logical) If TRUE, returns raw data in format specified by wt param

...

curl options passed on to crul::HttpClient

query

Query to use to delete documents

Details

We use json internally as data interchange format for this function.

Examples

## Not run: 
(cli <- SolrClient$new())

# add some documents first
ss <- list(list(id = 1, price = 100), list(id = 2, price = 500))
cli$add(ss, name = "gettingstarted")

# Now, delete them
# Delete by ID
cli$delete_by_id(ids = 1, "gettingstarted")
## Many IDs
cli$delete_by_id(ids = c(3, 4), "gettingstarted")

# Delete by query 
cli$search("gettingstarted", params=list(q="*:*")) # apple is there
cli$delete_by_query(query = 'id:apple', "gettingstarted") # delete it
cli$search("gettingstarted", params=list(q='id:apple')) # apple is now gone

## End(Not run)

solrium

General Purpose R Interface to 'Solr'

v1.1.4
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>), rOpenSci [fnd] (https://ropensci.org/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.