File: collection_balanceshardunique.R

package info (click to toggle)
r-cran-solrium 1.1.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,132 kB
  • sloc: xml: 374; sh: 13; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,749 bytes parent folder | download | duplicates (3)
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
39
#' @title Balance a property
#'
#' @description Insures that a particular property is distributed evenly
#' amongst the physical nodes that make up a collection. If the property
#' already exists on a replica, every effort is made to leave it there. If the
#' property is not on any replica on a shard one is chosen and the property
#' is added.
#'
#' @export
#' @inheritParams collection_create
#' @param property (character) Required. The property to balance. The literal
#' "property." is prepended to this property if not specified explicitly.
#' @param onlyactivenodes (logical) Normally, the property is instantiated
#' on active nodes only. If `FALSE`, then inactive nodes are also included
#' for distribution. Default: `TRUE`
#' @param shardUnique (logical) Something of a safety valve. There is one
#' pre-defined property (preferredLeader) that defaults this value to `TRUE`.
#' For all other properties that are balanced, this must be set to `TRUE` or
#' an error message is returned
#' @examples \dontrun{
#' (conn <- SolrClient$new())
#'
#' # create collection
#' if (!conn$collection_exists("addrep")) {
#'   conn$collection_create(name = "mycollection")
#'   # OR: bin/solr create -c mycollection
#' }
#'
#' # balance preferredLeader property
#' conn$collection_balanceshardunique("mycollection", property = "preferredLeader")
#'
#' # examine cluster status
#' conn$collection_clusterstatus()$cluster$collections$mycollection
#' }
collection_balanceshardunique <- function(conn, name, property, onlyactivenodes = TRUE,
                                          shardUnique = NULL, raw = FALSE, ...) {
  conn$collection_balanceshardunique(name, property, onlyactivenodes,
                                     shardUnique, raw, ...)
}