zeit_search {diezeit} | R Documentation |
Search the ZEIT archive
Description
zeit_search
exposes a search for ZEIT archive items.
You can set search queries, paginate, sort and partially select the fields,
that should be returned. Articles, that match your query, are returned with
a reduced set of meta data.
Usage
zeit_search(endpoint, query, fields, limit = 10, offset = 0, sort,
print = TRUE)
Arguments
endpoint |
one of |
query |
the main search query; single string value or vector of strings. |
fields |
partially select output fields, as string value or vector of strings for multiple fields. |
limit |
limit the amount of matches to return; set to |
offset |
offset for the list of matches; set to |
sort |
sort search results by any of the returned |
print |
if |
Details
Endpoints
The API is structured into several endpoints that provide specific functionalities:
author | search all authors | |
content | search for content | |
department | search all departments | |
keyword | search all keywords | |
product | search all products | |
series | search all series |
Query syntax
You can search the entire article text and all meta data simply by setting the query parameter to your search phrase. The search uses entire strings "as is". To search for multiple tokens use a vector of strings.
All fields of an article can be queried individually by using [field]:[search string]
.
For example, to get articles that have the word "Kennedy" in their headline, you would
search for "title:Kennedy"
.
Currently all endpoint
s other than content
only support simple search phrases
with asterisk (*
) wildcards.
Value
A list of matches to the query.
Source
http://developer.zeit.de/docs/
Examples
## Not run:
# simple content search
zeit_search(endpoint="content", query="bayreuth")
zeit_search("content", "bayreuth") # same same
# multiple tokens
zeit_search("content", c("bayreuth", "festspiele"))
# entire string
zeit_search("content", "bayreuther festspiele")
# field query
zeit_search("content", "title:bayreuth")
# partial selection
zeit_search("content", "bayreuth", fields=c("title", "teaser_text"))
# pagination
zeit_search("content", "bayreuth", limit=1) # just one match
zeit_search("content", "bayreuth", limit=1, offset=1) # just the second match
# sorting
zeit_search("content", "bayreuth",
sort=c("release_date", "asc")) # sort by date
zeit_search("content", "bayreuth",
sort=list(c("release_date", "desc"), c("title", "asc"))) # sort by date and title
# hide matches
bt.matches <- zeit_search("content", "bayreuth", print=FALSE)
# author search
zeit_search(endpoint="author", query="Stefan Locke")
## End(Not run)