Skip to content

Commit

Permalink
adds example
Browse files Browse the repository at this point in the history
  • Loading branch information
JBGruber committed May 28, 2024
1 parent 0f1e3a7 commit 3943ef5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ Remotes:
JBGruber/dockr
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
34 changes: 24 additions & 10 deletions R/index.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,34 @@ modify_index <- function(index, name = index, description = NULL, guest_role = N

#' Upload documents
#'
#' @param index The index name to create.
#' @param documents A data frame with columns title, text, date, and
#' optional other columns.
#' @param index The name of the index documents should be added to.
#' @param documents A data frame with columns title, text, date, and optional
#' other columns.
#' @param columns An optional list with data types, e.g. list(author =
#' "keyword").
#' @param chunk_size Uploads are broken into chunks to prevent errors.
#' Smaller chunks are less error-prone, but this also makes the
#' upload slower.
#' @param max_tries In case something goes wrong, how often should the
#' function retry to send the documents?
#' @param chunk_size Uploads are broken into chunks to prevent errors. Smaller
#' chunks are less error-prone, but this also makes the upload slower.
#' @param max_tries In case something goes wrong, how often should the function
#' retry to send the documents?
#' @param verbose Should a progress bar be printed during upload.
#' @param credentials The credentials to use. If not given, uses last
#' login information.
#' @param credentials The credentials to use. If not given, uses last login
#' information.
#'
#' @return Nothing.
#' @export
#'
#' @examples
#' \dontrun{
#' amcat_login("http://localhost/amcat")
#' docs <- data.frame(
#' date = "2024-01-01",
#' title = "This is a title",
#' text = "This is some text"
#' )
#' create_index(index = "new_index")
#' upload_documents(index = "new_index",
#' documents = docs)
#' }
upload_documents <- function(index,
documents,
columns = NULL,
Expand Down
35 changes: 25 additions & 10 deletions man/upload_documents.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3943ef5

Please sign in to comment.