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

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

# All orphaned packages
advanced_search(Maintainer = "ORPHANED")
#> - "advanced search" ----------------------------- 4 packages in 0.005 seconds -
#>   #     package   version  by         @ title                                  
#>  1  100 udunits2  0.13.2.2 ORPHANED  4M Udunits-2 Bindings for R               
#>  2  100 shipunov  1.17.1   ORPHANED  3y Miscellaneous Functions from Alexey ...
#>  3  100 jiebaR    0.11.1   ORPHANED  8M Chinese Text Segmentation              
#>  4  100 fastclime 1.4.1.1  ORPHANED  3y A Fast Solver for Parameterized LP P...

# Packages with both Hester and Wickham as authors
advanced_search(Author = "Hester", Author = "Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.025 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.5   Hadley Wickham     3M Mocking Library for R        
#>   2  85 memoise     2.0.1   Winston Chang      4y 'Memoisation' of Functions   
#>   3  85 pkgbuild    1.4.8   Gábor Csárdi       6M Find Tools Needed to Build...
#>   4  76 xml2        1.5.0   Jeroen Ooms        1d Parse XML                    
#>   5  73 meltr       1.0.2   Duncan Garmonsway  2y Read Non-Rectangular Text ...
#>   6  71 odbc        1.6.3   Hadley Wickham     2M Connect to ODBC Compatible...
#>   7  71 sessioninfo 1.2.3   Gábor Csárdi      10M R Session Information        
#>   8  70 remotes     2.5.0   Gábor Csárdi       2y R Package Installation fro...
#>   9  69 fs          1.6.6   Gábor Csárdi       7M Cross-Platform File System...
#>  10  69 devtools    2.4.6   Jennifer Bryan     2M Tools to Make Developing R...
advanced_search("Author: Hester AND Author: Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.004 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.5   Hadley Wickham     3M Mocking Library for R        
#>   2  85 memoise     2.0.1   Winston Chang      4y 'Memoisation' of Functions   
#>   3  85 pkgbuild    1.4.8   Gábor Csárdi       6M Find Tools Needed to Build...
#>   4  76 xml2        1.5.0   Jeroen Ooms        1d Parse XML                    
#>   5  73 meltr       1.0.2   Duncan Garmonsway  2y Read Non-Rectangular Text ...
#>   6  71 odbc        1.6.3   Hadley Wickham     2M Connect to ODBC Compatible...
#>   7  71 sessioninfo 1.2.3   Gábor Csárdi      10M R Session Information        
#>   8  70 remotes     2.5.0   Gábor Csárdi       2y R Package Installation fro...
#>   9  69 fs          1.6.6   Gábor Csárdi       7M Cross-Platform File System...
#>  10  69 devtools    2.4.6   Jennifer Bryan     2M Tools to Make Developing R...

# Packages with Hester but not Wickham as author
advanced_search(Author = "Hester AND NOT Wickham")
#> - "advanced search" ---------------------------- 27 packages in 0.134 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               2y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               9y Type Annotations    
#>   3  83 primerTree     1.1.0   Matt Cannon              2M Visually Assessin...
#>   4  75 rex            1.2.1   Kevin Ushey              4y Friendly Regular ...
#>   5  71 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  67 roger          1.5.1   Vincent Goulet           2y Automated Grading...
#>   7  67 spelling       2.3.2   Jeroen Ooms              3M Tools for Spell C...
#>   8  63 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  62 bench          1.1.4   Davis Vaughan           10M High Precision Ti...
#>  10  62 tidycode       0.1.1   Lucy D'Agostino McGowan  6y Analyze Lines of ...

# Packages with Hester as an Author, and Wickham in any field
advanced_search(Author = "Hester", "Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.036 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.5   Hadley Wickham     3M Mocking Library for R        
#>   2  85 odbc        1.6.3   Hadley Wickham     2M Connect to ODBC Compatible...
#>   3  82 pkgbuild    1.4.8   Gábor Csárdi       6M Find Tools Needed to Build...
#>   4  79 memoise     2.0.1   Winston Chang      4y 'Memoisation' of Functions   
#>   5  74 xml2        1.5.0   Jeroen Ooms        1d Parse XML                    
#>   6  73 S7          0.2.1   Hadley Wickham     4d An Object Oriented System ...
#>   7  70 sessioninfo 1.2.3   Gábor Csárdi      10M R Session Information        
#>   8  69 devtools    2.4.6   Jennifer Bryan     2M Tools to Make Developing R...
#>   9  68 remotes     2.5.0   Gábor Csárdi       2y R Package Installation fro...
#>  10  68 meltr       1.0.2   Duncan Garmonsway  2y Read Non-Rectangular Text ...

# Packages with Hester as an Author and Wickham nowhere in the metadata
advanced_search(Author = "Hester", "NOT Wickham")
#> - "advanced search" ---------------------------- 27 packages in 0.039 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               2y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               9y Type Annotations    
#>   3  83 primerTree     1.1.0   Matt Cannon              2M Visually Assessin...
#>   4  75 rex            1.2.1   Kevin Ushey              4y Friendly Regular ...
#>   5  71 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  67 roger          1.5.1   Vincent Goulet           2y Automated Grading...
#>   7  67 spelling       2.3.2   Jeroen Ooms              3M Tools for Spell C...
#>   8  63 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  62 bench          1.1.4   Davis Vaughan           10M High Precision Ti...
#>  10  62 tidycode       0.1.1   Lucy D'Agostino McGowan  6y Analyze Lines of ...

# Packages for permutation tests and permissive licenses
advanced_search("permutation test AND NOT License: GPL OR GNU")
#> - "advanced search" --------------------------- 660 packages in 0.167 seconds -
#>   #     package   version by                         @ title                   
#>   1 100 phd       0.2     Jesse Hemerik             4y Permutation Testing i...
#>   2  94 confSAM   0.2     Jesse Hemerik             8y Estimates and Bounds ...
#>   3  91 permutes  2.8     Cesko C. Voeten           2y Permutation Tests for...
#>   4  78 BurStMisc 1.1     Pat Burns                 9y Burns Statistics Misc...
#>   5  75 resample  0.6     Tim Hesterberg            3y Resampling Functions    
#>   6  74 IMEC      0.2.0   Maximilian Maier          5y Ising Model of Explan...
#>   7  74 USP       0.1.2   Thomas B. Berrett         5y U-Statistic Permutati...
#>   8  73 DRPT      1.1     Alberto Bordino           4M Density Ratio Permuta...
#>   9  72 packager  1.15.3  Andreas Dominik Cullmann  6M Create, Build and Mai...
#>  10  69 fdrci     2.4     Joshua Millstein          3y Permutation-Based FDR...

# Packages that have a certain field
advanced_search("_exists_" = "URL")
#> - "advanced search" ------------------------- 10000 packages in 0.018 seconds -
#>   #     package     version by                       @ title                   
#>   1 100 autometric  0.1.2   William Michael Landau  1y Background Resource L...
#>   2 100 rules       1.0.2   Emil Hvitfeldt          3y Model Wrappers for Ru...
#>   3 100 palr        0.4.0   Michael D. Sumner       2y Colour Palettes for Data
#>   4 100 emayili     0.9.3   Andrew B. Collier       9M Send Email Messages     
#>   5 100 funModeling 1.9.5   Pablo Casas             2y Exploratory Data Anal...
#>   6 100 ccaPP       0.3.5   Andreas Alfons          2M (Robust) Canonical Co...
#>   7 100 DPQ         0.6.1   Martin Maechler         1M Density, Probability,...
#>   8 100 statsr      0.3.0   Merlise Clyde           5y Companion Software fo...
#>   9 100 tsne        0.1.3.1 Justin Donaldson        4y T-Distributed Stochas...
#>  10 100 fmeffects   0.1.4   Holger Löwe             1y Model-Agnostic Interp...

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")
#> - "advanced search" ------------------------- 10000 packages in 0.021 seconds -
#>   #     package     version by                             @ title             
#>   1 NaN PMCMR       4.4     Thorsten Pohlert              4y Calculate Pairw...
#>   2 NaN cellWise    2.5.4   Jakob Raymaekers              2M Analyzing Data ...
#>   3 NaN hdi         0.1.10  Lukas Meier                   7M High-Dimensiona...
#>   4 NaN forestmodel 0.6.2   Nick Kennedy                  5y Forest Plots fr...
#>   5 NaN cshapes     2.0     Luc Girardin                  4y The CShapes 2.0...
#>   6 NaN SpATS       1.0.19  Maria Xose Rodriguez-Alvarez  1y Spatial Analysi...
#>   7 NaN csv         0.6.2   Tim Bergsma                   3y Read and Write ...
#>   8 NaN regclass    1.7     Adam Petrie                   6M Tools for an In...
#>   9 NaN HMM         1.0.2   Lin Himmelmann                6M Hidden Markov M...
#>  10 NaN labstatR    1.0.13  Stefano M. Iacus              3y Libreria Del La...

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)
#> - "advanced search" ------------------------- 10000 packages in 0.027 seconds -
#>   #     package     version by                             @ title             
#>   1 NaN PMCMR       4.4     Thorsten Pohlert              4y Calculate Pairw...
#>   2 NaN cellWise    2.5.4   Jakob Raymaekers              2M Analyzing Data ...
#>   3 NaN hdi         0.1.10  Lukas Meier                   7M High-Dimensiona...
#>   4 NaN forestmodel 0.6.2   Nick Kennedy                  5y Forest Plots fr...
#>   5 NaN cshapes     2.0     Luc Girardin                  4y The CShapes 2.0...
#>   6 NaN SpATS       1.0.19  Maria Xose Rodriguez-Alvarez  1y Spatial Analysi...
#>   7 NaN csv         0.6.2   Tim Bergsma                   3y Read and Write ...
#>   8 NaN regclass    1.7     Adam Petrie                   6M Tools for an In...
#>   9 NaN HMM         1.0.2   Lin Himmelmann                6M Hidden Markov M...
#>  10 NaN labstatR    1.0.13  Stefano M. Iacus              3y Libreria Del La...

# Regular expressions
advanced_search(Author = "/Joh?nathan/")
#> - "advanced search" ----------------------------- 0 packages in 0.062 seconds -

# Fuzzy search
advanced_search(Author = "Johnathan~1")
#> - "advanced search" --------------------------- 291 packages in 0.109 seconds -
#>   #     package    version by                                        @ title   
#>   1 100 mlmi       1.1.2   Jonathan Bartlett                        2y Maxim...
#>   2 100 chords     0.95.4  Jonathan Rosenblatt                      9y Estim...
#>   3 100 lda        1.5.2   Santiago Olivella                        2y Colla...
#>   4 100 rSHAPE     0.3.2   Jonathan Dench                           6y Simul...
#>   5 100 handyplots 1.1.3   Jonathan Schwartz                        7y Handy...
#>   6 100 UnitCircle 0.1.3   Jonathan Berrisch                        7y Check...
#>   7  96 ClamR      2.1.3   Jonathan M. Lees<jonathan.lees@unc.edu>  2y Time ...
#>   8  96 RSeed      0.1.60  Claus Jonathan Fritzemeier               9y Boren...
#>   9  92 bootImpute 1.2.2   Jonathan Bartlett                        8M Boots...
#>  10  92 RcppTN     0.2.2   Jonathan Olmsted                         8y Rcpp-...