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" ----------------------------- 3 packages in 0.003 seconds -
#>   #     package   version  by         @ title                                  
#>  1  100 fastclime 1.4.1.1  ORPHANED  1y A Fast Solver for Parameterized LP P...
#>  2  100 udunits2  0.13.2.1 ORPHANED  2y Udunits-2 Bindings for R               
#>  3  100 shipunov  1.17.1   ORPHANED  1y Miscellaneous Functions from Alexey ...

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

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

# Packages with Hester as an Author, and Wickham in any field
advanced_search(Author = "Hester", "Wickham")
#> - "advanced search" ---------------------------- 22 packages in 0.007 seconds -
#>   #     package     version by               @ title                           
#>   1 100 mockery     0.4.4   Hadley Wickham  7M Mocking Library for R           
#>   2  88 xml2        1.3.6   Hadley Wickham  5M Parse XML                       
#>   3  88 odbc        1.4.2   Hadley Wickham  3M Connect to ODBC Compatible Da...
#>   4  87 pkgbuild    1.4.4   Gábor Csárdi    1M Find Tools Needed to Build R ...
#>   5  77 memoise     2.0.1   Winston Chang   2y 'Memoisation' of Functions      
#>   6  75 devtools    2.4.5   Jennifer Bryan  2y Tools to Make Developing R Pa...
#>   7  75 S7          0.1.1   Hadley Wickham  7M An Object Oriented System Mea...
#>   8  72 sessioninfo 1.2.2   Gábor Csárdi    2y R Session Information           
#>   9  67 fs          1.6.3   Gábor Csárdi    9M Cross-Platform File System Op...
#>  10  67 remotes     2.5.0   Gábor Csárdi    1M R Package Installation from R...

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

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

# Packages that have a certain field
advanced_search("_exists_" = "URL")
#> - "advanced search" ------------------------- 10000 packages in 0.007 seconds -
#>   #     package           version by                        @ title            
#>   1 100 goodpractice      1.0.4   Karina Marks             2y Advice on R Pa...
#>   2 100 assertive.base    0.0.9   Richard Cotton           3y A Lightweight ...
#>   3 100 wordbankr         1.0.3   Mika Braginsky           2M Accessing the ...
#>   4 100 treeclim          2.0.6.0 Christian Zang           2y Numerical Cali...
#>   5 100 assertive.numbers 0.0.2   Richard Cotton           8y Assertions to ...
#>   6 100 cwbtools          0.4.1   Andreas Blaette         25d Tools to Creat...
#>   7 100 assertive.files   0.0.2   Richard Cotton           8y Assertions to ...
#>   8 100 SPOT              2.11.14 Thomas Bartz-Beielstein  2y Sequential Par...
#>   9 100 EventStudy        0.39.2  Dr. Simon Mueller        1y Event Study An...
#>  10 100 restorepoint      0.2     Roman Zenka              5y Debugging with...

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")
#> - "advanced search" -------------------------- 9735 packages in 0.022 seconds -
#>   #     package          version by                        @ title             
#>   1 NaN ALSM             0.2.0   Ali Ghanbari             7y Companion to Ap...
#>   2 NaN pequod           0.0.5   Alberto Mirisola         8y Moderated Regre...
#>   3 NaN DynNom           5.0.2   Amirhossein Jalali       2y Visualising Sta...
#>   4 NaN highSCREEN       0.4     Ivo D. Shterev           3y High-Throughput...
#>   5 NaN RcmdrPlugin.coin 1.0.23  Daniel-Corneliu Leucuta  2y Rcmdr Coin Plug-in
#>   6 NaN hergm            4.1.10  Michael Schweinberger    1y Hierarchical Ex...
#>   7 NaN RcmdrPlugin.SCDA 1.2.0   Tamal Kumar De           5y Rcmdr Plugin fo...
#>   8 NaN wTO              2.0.2   Deisy Morselli Gysi      1y Computing Weigh...
#>   9 NaN Bios2cor         2.2.1   Marie Chabbert           2y From Biological...
#>  10 NaN MasterBayes      2.58    Jarrod Hadfield          2y ML and MCMC Met...

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)
#> - "advanced search" -------------------------- 9735 packages in 0.017 seconds -
#>   #     package          version by                        @ title             
#>   1 NaN ALSM             0.2.0   Ali Ghanbari             7y Companion to Ap...
#>   2 NaN pequod           0.0.5   Alberto Mirisola         8y Moderated Regre...
#>   3 NaN DynNom           5.0.2   Amirhossein Jalali       2y Visualising Sta...
#>   4 NaN highSCREEN       0.4     Ivo D. Shterev           3y High-Throughput...
#>   5 NaN RcmdrPlugin.coin 1.0.23  Daniel-Corneliu Leucuta  2y Rcmdr Coin Plug-in
#>   6 NaN hergm            4.1.10  Michael Schweinberger    1y Hierarchical Ex...
#>   7 NaN RcmdrPlugin.SCDA 1.2.0   Tamal Kumar De           5y Rcmdr Plugin fo...
#>   8 NaN wTO              2.0.2   Deisy Morselli Gysi      1y Computing Weigh...
#>   9 NaN Bios2cor         2.2.1   Marie Chabbert           2y From Biological...
#>  10 NaN MasterBayes      2.58    Jarrod Hadfield          2y ML and MCMC Met...

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

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