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.004 seconds -
#>   #     package   version  by         @ title                                  
#>  1  100 jiebaR    0.11.1   ORPHANED 14d Chinese Text Segmentation              
#>  2  100 udunits2  0.13.2.1 ORPHANED  3y Udunits-2 Bindings for R               
#>  3  100 shipunov  1.17.1   ORPHANED  2y Miscellaneous Functions from Alexey ...
#>  4  100 fastclime 1.4.1.1  ORPHANED  2y 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.021 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     2y Mocking Library for R        
#>   2  94 pkgbuild    1.4.7   Gábor Csárdi      19d Find Tools Needed to Build...
#>   3  85 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   4  79 devtools    2.4.5   Jennifer Bryan     3y Tools to Make Developing R...
#>   5  75 xml2        1.3.8   Jeroen Ooms       29d Parse XML                    
#>   6  75 odbc        1.6.1   Hadley Wickham    16d Connect to ODBC Compatible...
#>   7  72 meltr       1.0.2   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>   8  71 sessioninfo 1.2.3   Gábor Csárdi       2M R Session Information        
#>   9  69 remotes     2.5.0   Gábor Csárdi       1y R Package Installation fro...
#>  10  68 fs          1.6.6   Gábor Csárdi       3h Cross-Platform File System...
advanced_search("Author: Hester AND Author: Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.007 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     2y Mocking Library for R        
#>   2  94 pkgbuild    1.4.7   Gábor Csárdi      19d Find Tools Needed to Build...
#>   3  85 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   4  79 devtools    2.4.5   Jennifer Bryan     3y Tools to Make Developing R...
#>   5  75 xml2        1.3.8   Jeroen Ooms       29d Parse XML                    
#>   6  75 odbc        1.6.1   Hadley Wickham    16d Connect to ODBC Compatible...
#>   7  72 meltr       1.0.2   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>   8  71 sessioninfo 1.2.3   Gábor Csárdi       2M R Session Information        
#>   9  69 remotes     2.5.0   Gábor Csárdi       1y R Package Installation fro...
#>  10  68 fs          1.6.6   Gábor Csárdi       3h Cross-Platform File System...

# Packages with Hester but not Wickham as author
advanced_search(Author = "Hester AND NOT Wickham")
#> - "advanced search" ---------------------------- 27 packages in 0.022 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               1y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               8y Type Annotations    
#>   3  82 primerTree     1.0.6   Matt Cannon              3y Visually Assessin...
#>   4  74 rex            1.2.1   Kevin Ushey              3y Friendly Regular ...
#>   5  70 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  68 spelling       2.3.1   Jeroen Ooms              6M Tools for Spell C...
#>   7  66 roger          1.5.1   Vincent Goulet           1y Automated Grading...
#>   8  62 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  60 bench          1.1.4   Davis Vaughan            3M High Precision Ti...
#>  10  60 tidycode       0.1.1   Lucy D'Agostino McGowan  5y 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.005 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     2y Mocking Library for R        
#>   2  88 pkgbuild    1.4.7   Gábor Csárdi      19d Find Tools Needed to Build...
#>   3  88 odbc        1.6.1   Hadley Wickham    16d Connect to ODBC Compatible...
#>   4  77 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   5  75 devtools    2.4.5   Jennifer Bryan     3y Tools to Make Developing R...
#>   6  74 S7          0.2.0   Hadley Wickham     5M An Object Oriented System ...
#>   7  73 xml2        1.3.8   Jeroen Ooms       29d Parse XML                    
#>   8  68 sessioninfo 1.2.3   Gábor Csárdi       2M R Session Information        
#>   9  67 remotes     2.5.0   Gábor Csárdi       1y R Package Installation fro...
#>  10  66 meltr       1.0.2   Duncan Garmonsway  1y 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.003 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               1y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               8y Type Annotations    
#>   3  82 primerTree     1.0.6   Matt Cannon              3y Visually Assessin...
#>   4  74 rex            1.2.1   Kevin Ushey              3y Friendly Regular ...
#>   5  70 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  68 spelling       2.3.1   Jeroen Ooms              6M Tools for Spell C...
#>   7  66 roger          1.5.1   Vincent Goulet           1y Automated Grading...
#>   8  62 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  60 bench          1.1.4   Davis Vaughan            3M High Precision Ti...
#>  10  60 tidycode       0.1.1   Lucy D'Agostino McGowan  5y Analyze Lines of ...

# Packages for permutation tests and permissive licenses
advanced_search("permutation test AND NOT License: GPL OR GNU")
#> - "advanced search" --------------------------- 593 packages in 0.033 seconds -
#>   #     package       version by                         @ title               
#>   1 100 phd           0.2     Jesse Hemerik             3y Permutation Testi...
#>   2  94 confSAM       0.2     Jesse Hemerik             7y Estimates and Bou...
#>   3  89 permutes      2.8     Cesko C. Voeten           2y Permutation Tests...
#>   4  78 BurStMisc     1.1     Pat Burns                 9y Burns Statistics ...
#>   5  75 resample      0.6     Tim Hesterberg            3y Resampling Functions
#>   6  74 USP           0.1.2   Thomas B. Berrett         4y U-Statistic Permu...
#>   7  74 IMEC          0.2.0   Maximilian Maier          4y Ising Model of Ex...
#>   8  72 packager      1.15.2  Andreas Dominik Cullmann  2y Create, Build and...
#>   9  69 fdrci         2.4     Joshua Millstein          2y Permutation-Based...
#>  10  68 MultSurvTests 0.2     Lukas Arnroth             4y Permutation Tests...

# Packages that have a certain field
advanced_search("_exists_" = "URL")
#> - "advanced search" ------------------------- 10000 packages in 0.037 seconds -
#>   #     package      version by                          @ title               
#>   1 100 zstdlite     0.2.7   Mike Cheng                 1y Fast Compression ...
#>   2 100 ingres       1.0.0   Pedro Victori              3y Infer Gene Probab...
#>   3 100 pkgstats     0.1.1   Mark Padgham               3y Metrics of R Pack...
#>   4 100 irtplay      1.6.5   Hwanggyu Lim               3y Unidimensional It...
#>   5 100 opentimsr    1.0.13  Michał Piotr Startek       3y An Open-Source Lo...
#>   6 100 cycleRtools  1.1.1   Jordan Mackie              9y Tools for Cycling...
#>   7 100 webqueue     1.0.0   Daniel P. Smith           30d Multicore HTTP Se...
#>   8 100 viruslearner 0.0.2   Juan Pablo Acuña González  1y Ensemble Learning...
#>   9 100 uniswappeR   0.6.1   Eric Hare                  2y Interact with the...
#>  10 100 hydrorecipes 0.0.3   Jonathan Kennel            3y Hydrogeology Step...

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")
#> - "advanced search" ------------------------- 10000 packages in 0.016 seconds -
#>   #     package      version by                             @ title            
#>   1 NaN qVarSel      1.1     Stefano Benati                5M Select Variabl...
#>   2 NaN jsontools    0.1.0   Maximilian Girlich            4y Working with J...
#>   3 NaN mudens       1.3.2   Kenneth R. Hess               6y Density Estimate 
#>   4 NaN Rdsm         2.1.1   Norm Matloff                 11y Threads Enviro...
#>   5 NaN webtools     0.7.12  LS Malenica                   3y Various Useful...
#>   6 NaN soobench     1.9.18  Eric Kalosa-Kenyon            5y Single Objecti...
#>   7 NaN Replication  0.1.2   M.A.J. Zondervan-Zwijnenburg  5y Test Replicati...
#>   8 NaN WLinfer      1.2.0   Sungbum Kim                   3y Statistical In...
#>   9 NaN vertexenum   1.0.2   Robert Robere                 7y Vertex Enumera...
#>  10 NaN xpose.nlmixr 0.3.0   Justin Wilkins                3y Graphical Diag...

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)
#> - "advanced search" ------------------------- 10000 packages in 0.006 seconds -
#>   #     package      version by                             @ title            
#>   1 NaN qVarSel      1.1     Stefano Benati                5M Select Variabl...
#>   2 NaN jsontools    0.1.0   Maximilian Girlich            4y Working with J...
#>   3 NaN mudens       1.3.2   Kenneth R. Hess               6y Density Estimate 
#>   4 NaN Rdsm         2.1.1   Norm Matloff                 11y Threads Enviro...
#>   5 NaN webtools     0.7.12  LS Malenica                   3y Various Useful...
#>   6 NaN soobench     1.9.18  Eric Kalosa-Kenyon            5y Single Objecti...
#>   7 NaN Replication  0.1.2   M.A.J. Zondervan-Zwijnenburg  5y Test Replicati...
#>   8 NaN WLinfer      1.2.0   Sungbum Kim                   3y Statistical In...
#>   9 NaN vertexenum   1.0.2   Robert Robere                 7y Vertex Enumera...
#>  10 NaN xpose.nlmixr 0.3.0   Justin Wilkins                3y Graphical Diag...

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

# Fuzzy search
advanced_search(Author = "Johnathan~1")
#> - "advanced search" --------------------------- 282 packages in 0.052 seconds -
#>   #     package       version by                                        @ title
#>   1 100 lda           1.5.2   Santiago Olivella                        1y Co...
#>   2 100 chords        0.95.4  Jonathan Rosenblatt                      8y Es...
#>   3 100 mlmi          1.1.2   Jonathan Bartlett                        2y Ma...
#>   4 100 rSHAPE        0.3.2   Jonathan Dench                           6y Si...
#>   5 100 handyplots    1.1.3   Jonathan Schwartz                        6y Ha...
#>   6 100 UnitCircle    0.1.3   Jonathan Berrisch                        7y Ch...
#>   7  96 ClamR         2.1.3   Jonathan M. Lees<jonathan.lees@unc.edu>  2y Ti...
#>   8  96 RSeed         0.1.60  Claus Jonathan Fritzemeier               9y Bo...
#>   9  92 restrictedMVN 1.0     Yuval Benjamini                          8y Mu...
#>  10  92 ggedit        0.4.1   Jonathan Sidi                            1y In...