R/search.R

Defines functions hirs_search

Documented in hirs_search

#' Search
#'
#' @export
#' @param index (character) A character vector of index names
#' @param body a named list passed to HTTP body
#' @param column_attrs column attributes
#' @param slices slices
#' @param raw If `TRUE` (default), data is parsed to list. If `FALSE`, 
#' then raw JSON.
#' @param ... Curl args passed on to [crul::HttpClient]
#' @references <https://www.pilosa.com/docs/latest/api-reference/>
#' @examples \dontrun{
#' hirs_search("repository", 'Bitmap(frame="language", rowID=5)')
#' hirs_search("repository", 'Bitmap(frame="language", rowID=5)', 
#'    columnAttrs = TRUE, slices = "0,1")
#' hirs_search("repository", 'Count(Bitmap(frame="stargazer", rowID=10))')
#' 
#' # error
#' # hirs_search("repository", 
#' #  'Union(Bitmap(frame="stargazer", stargazer_id=1), Bitmap(frame="stargazer", stargazer_id=2))')
#' }
hirs_search <- function(index, body, column_attrs = NULL, slices = NULL, 
  raw = FALSE, ...) {

  args <- comp(list(columnAttrs = column_attrs, slices = slices))
  hir_POST(file.path("index", index, "query"), query = args, 
    body = body, ...)
}
ropenscilabs/hirsutosa documentation built on May 11, 2022, 6:50 a.m.