advanced_search: Advanced CRAN package search

Description Usage Arguments Value Examples

View source: R/advanced_search.R

Description

See the Elastic documentation for the syntax and features: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

Usage

1
2
3
4
5
6
7
advanced_search(
  ...,
  json = NULL,
  format = c("short", "long"),
  from = 1,
  size = 10
)

Arguments

...

Search terms. For named terms, the name specifies the field to search for. For unnamed ones, the term is taken as is. The individual terms are combined with the AND operator.

json

A character string that contains the query to send to Elastic. If this is not NULL, then you cannot specify any search terms in ....

format

Default formatting of the results. short only outputs the name and title of the packages, long also prints the author, last version, full description and URLs. Note that this only affects the default printing, and you can still inspect the full results, even if you specify short here.

from

Where to start listing the results, for pagination.

size

The number of results to list.

Value

Search hits.

Examples

 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
# All orphaned packages
advanced_search(Maintainer = "ORPHANED")

# Packages that match a certain field
advanced_search(Author = "Hester AND NOT Wickham")

# Packages for permutation tests and permissive licenses
advanced_search("permutation test AND NOT License: GPL OR GNU")

# Packages that have a certain field
advanced_search("_exists_" = "URL")

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)

# Regular expressions
advanced_search(Author = "/Joh?nathan/")

# Fuzzy search
advanced_search(Author = "Johnathan~1")

pkgsearch documentation built on Oct. 23, 2020, 7:12 p.m.