% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tw_search.R
\name{tw_search_single}
\alias{tw_search_single}
\title{Search for Wikidata items or properties and return Wikidata id, label, and
description.}
\usage{
tw_search_single(
  search,
  type = "item",
  language = tidywikidatar::tw_get_language(),
  response_language = tidywikidatar::tw_get_language(),
  limit = 10,
  retry = 10,
  include_search = FALSE,
  user_agent = tidywikidatar::tw_get_user_agent(),
  cache = NULL,
  overwrite_cache = FALSE,
  cache_connection = NULL,
  disconnect_db = TRUE,
  wait = 0
)
}
\arguments{
\item{search}{A string to be searched in Wikidata}

\item{type}{Defaults to "item". Either "item" or "property".}

\item{language}{Language to be used for the search. Can be set once per
session with \code{\link[=tw_set_language]{tw_set_language()}}. If not set, defaults to "en". For a full
list, see
\href{https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all}{the
dedicated Wikimedia page}.}

\item{response_language}{Language to be used for the returned labels and
descriptions. Corresponds to the \code{uselang} parameter of the MediaWiki API,
as described
\href{https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities}{in
the official documentation}. Can be set once per session with
\code{\link[=tw_set_language]{tw_set_language()}}. If not set, defaults to "en". For a full list, see
\href{https://www.wikidata.org/wiki/Help:Wikimedia_language_codes/lists/all}{all
available language codes}.}

\item{limit}{Maximum numbers of responses to be given.}

\item{retry}{Defaults to 10. Maximum number of times to retry if the API
throws an error, such as "too many requests". Each time, it will wait as
much time as requested by the API. Notice that this can be a long time,
e.g. 30 minutes. Set to \code{FALSE} if you prefer the API to throw an error
immediately. Consider adjusting the \code{wait} parameter, or customising the
\code{user_agent} if relevant.}

\item{include_search}{Logical, defaults to \code{FALSE}. If \code{TRUE}, the search is
returned as an additional column.}

\item{user_agent}{Defaults to \code{NULL}. If not given, implicitly defaults to
current package name (\code{tidywikidatar}) and version.}

\item{cache}{Defaults to \code{NULL}. If given, it should be given either \code{TRUE}
or \code{FALSE.} Typically set with \code{\link[=tw_enable_cache]{tw_enable_cache()}} or \code{\link[=tw_disable_cache]{tw_disable_cache()}}.}

\item{overwrite_cache}{Defaults to \code{FALSE}. If \code{TRUE}, overwrites cache.}

\item{cache_connection}{Defaults to \code{NULL}. If \code{NULL}, and caching is
enabled, \code{tidywikidatar} will use a local sqlite database. A custom
connection to other databases can be given (see vignette \code{caching} for
details).}

\item{disconnect_db}{Defaults to \code{TRUE}. If \code{FALSE}, leaves the connection to
cache open.}

\item{wait}{In seconds, defaults to 0. Time to wait between queries to
Wikidata. If data are cached locally, wait time is not applied. If you are
running many queries systematically you may want to add some waiting time
between queries.}
}
\value{
A data frame (a tibble) with three columns (\code{id}, \code{label}, and
\code{description}), and as many rows as there are results (by default, limited
to 10). Four columns when \code{include_search} is set to \code{TRUE}.
}
\description{
This search returns only items, use \code{\link[=tw_search_property]{tw_search_property()}} for properties.
}
\examples{
\dontrun{
  tidywikidatar:::tw_search_single(search = "Sylvia Pankhurst")
}
}
