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.001 seconds -
#>   #     package   version  by         @ title                                  
#>  1  100 overlap   0.3.4.1  ORPHANED 23d Estimates of Coefficient of Overlapp...
#>  2  100 udunits2  0.13.2.1 ORPHANED  2y Udunits-2 Bindings for R               
#>  3   98 shipunov  1.17.1   ORPHANED 10M Miscellaneous Functions from Alexey ...
#>  4   95 fastclime 1.4.1.1  ORPHANED  7M A Fast Solver for Parameterized LP P...

# Packages with both Hester and Wickham as authors
advanced_search(Author = "Hester", Author = "Wickham")
#> - "advanced search" ---------------------------- 21 packages in 0.004 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     3M Mocking Library for R        
#>   2  98 pkgbuild    1.4.3   Gábor Csárdi      10h Find Tools Needed to Build...
#>   3  89 memoise     2.0.1   Winston Chang      2y 'Memoisation' of Functions   
#>   4  84 odbc        1.3.5   Hadley Wickham     5M Connect to ODBC Compatible...
#>   5  84 devtools    2.4.5   Jennifer Bryan     1y Tools to Make Developing R...
#>   6  82 xml2        1.3.6   Hadley Wickham     6d Parse XML                    
#>   7  81 sessioninfo 1.2.2   Gábor Csárdi       2y R Session Information        
#>   8  74 remotes     2.4.2.1 Gábor Csárdi       5M R Package Installation fro...
#>   9  74 meltr       1.0.1   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>  10  69 pkgload     1.3.3   Lionel Henry       3M Simulate Package Installat...
advanced_search("Author: Hester AND Author: Wickham")
#> - "advanced search" ---------------------------- 21 packages in 0.002 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     3M Mocking Library for R        
#>   2  98 pkgbuild    1.4.3   Gábor Csárdi      10h Find Tools Needed to Build...
#>   3  89 memoise     2.0.1   Winston Chang      2y 'Memoisation' of Functions   
#>   4  84 odbc        1.3.5   Hadley Wickham     5M Connect to ODBC Compatible...
#>   5  84 devtools    2.4.5   Jennifer Bryan     1y Tools to Make Developing R...
#>   6  82 xml2        1.3.6   Hadley Wickham     6d Parse XML                    
#>   7  81 sessioninfo 1.2.2   Gábor Csárdi       2y R Session Information        
#>   8  74 remotes     2.4.2.1 Gábor Csárdi       5M R Package Installation fro...
#>   9  74 meltr       1.0.1   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>  10  69 pkgload     1.3.3   Lionel Henry       3M Simulate Package Installat...

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

# Packages with Hester as an Author, and Wickham in any field
advanced_search(Author = "Hester", "Wickham")
#> - "advanced search" ---------------------------- 21 packages in 0.005 seconds -
#>   #     package     version by               @ title                           
#>   1 100 mockery     0.4.4   Hadley Wickham  3M Mocking Library for R           
#>   2  95 odbc        1.3.5   Hadley Wickham  5M Connect to ODBC Compatible Da...
#>   3  93 xml2        1.3.6   Hadley Wickham  6d Parse XML                       
#>   4  90 pkgbuild    1.4.3   Gábor Csárdi   10h Find Tools Needed to Build R ...
#>   5  80 devtools    2.4.5   Jennifer Bryan  1y Tools to Make Developing R Pa...
#>   6  79 memoise     2.0.1   Winston Chang   2y 'Memoisation' of Functions      
#>   7  78 S7          0.1.1   Hadley Wickham  3M An Object Oriented System Mea...
#>   8  73 sessioninfo 1.2.2   Gábor Csárdi    2y R Session Information           
#>   9  69 remotes     2.4.2.1 Gábor Csárdi    5M R Package Installation from R...
#>  10  67 pkgload     1.3.3   Lionel Henry    3M Simulate Package Installation...

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

# Packages for permutation tests and permissive licenses
advanced_search("permutation test AND NOT License: GPL OR GNU")
#> - "advanced search" --------------------------- 476 packages in 0.019 seconds -
#>   #     package           version by                         @ title           
#>   1 100 phd               0.2     Jesse Hemerik             2y Permutation T...
#>   2  95 confSAM           0.2     Jesse Hemerik             6y Estimates and...
#>   3  86 permutes          2.8     Cesko C. Voeten           2M Permutation T...
#>   4  80 BurStMisc         1.1     Pat Burns                 7y Burns Statist...
#>   5  78 packager          1.15.2  Andreas Dominik Cullmann  4M Create, Build...
#>   6  78 USP               0.1.2   Thomas B. Berrett         3y U-Statistic P...
#>   7  77 resample          0.6     Tim Hesterberg            1y Resampling Fu...
#>   8  71 MultSurvTests     0.2     Lukas Arnroth             2y Permutation T...
#>   9  71 fdrci             2.4     Joshua Millstein          1y Permutation-B...
#>  10  69 phyloseqGraphTest 0.1.0   Julia Fukuyama            4y Graph-Based P...

# Packages that have a certain field
advanced_search("_exists_" = "URL")
#> - "advanced search" ------------------------- 11950 packages in 0.001 seconds -
#>   #     package          version by                     @ title                
#>   1 100 opentimsr        1.0.13  Michał Piotr Startek  2y An Open-Source Loa...
#>   2 100 TSDT             1.0.7   Brian Denton          2y Treatment-Specific...
#>   3 100 threesixtygiving 0.2.2   Evan Odell            3y Download Charitabl...
#>   4 100 eaf              2.5     Manuel López-Ibáñez  12d Plots of the Empir...
#>   5 100 retry            0.1.0   Randy Lai             4y Repeated Evaluation  
#>   6 100 DataCombine      0.2.21  Christopher Gandrud   8y Tools for Easily C...
#>   7 100 wpp2017          1.2.3   Hana Sevcikova        4y World Population P...
#>   8 100 fuzzySim         4.10.5  A. Marcia Barbosa     2M Fuzzy Similarity i...
#>   9 100 SAMtool          1.6.3   Quang Huynh          23d Stock Assessment M...
#>  10 100 SDMtune          1.3.1   Sergio Vignali        5M Species Distributi...

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")
#> - "advanced search" -------------------------- 9551 packages in 0.001 seconds -
#>   #     package          version by                 @ title                    
#>   1 100 RCMinification   1.2     L. Han           11M Random Coefficient Min...
#>   2 100 simpleFDR        1.1     Stephen Wisser    2y Simple False Discovery...
#>   3 100 NegBinBetaBinreg 1.0     Edilberto Cepeda  7y Negative Binomial and ...
#>   4 100 RegKink          0.1.0   Lixiong Yang      3y Regression Kink with a...
#>   5 100 YPmodelPhreg     1.0.0   Daewoo Pak        5M The Short-Term and Lon...
#>   6 100 rebus.unicode    0.0.2   Richard Cotton    7y Unicode Extensions for...
#>   7 100 didimputation    0.3.0   Kyle Butts        1y Imputation Estimator f...
#>   8 100 spmoran          0.2.2.9 Daisuke Murakami  8M Fast Spatial Regressio...
#>   9 100 seqHMM           1.2.6   Jouni Helske      5M Mixture Hidden Markov ...
#>  10 100 SQRL             1.0.2   Mike Lee          8d Enhances Interaction w...

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)
#> - "advanced search" -------------------------- 9551 packages in 0.002 seconds -
#>   #     package          version by                 @ title                    
#>   1 100 RCMinification   1.2     L. Han           11M Random Coefficient Min...
#>   2 100 simpleFDR        1.1     Stephen Wisser    2y Simple False Discovery...
#>   3 100 NegBinBetaBinreg 1.0     Edilberto Cepeda  7y Negative Binomial and ...
#>   4 100 RegKink          0.1.0   Lixiong Yang      3y Regression Kink with a...
#>   5 100 YPmodelPhreg     1.0.0   Daewoo Pak        5M The Short-Term and Lon...
#>   6 100 rebus.unicode    0.0.2   Richard Cotton    7y Unicode Extensions for...
#>   7 100 didimputation    0.3.0   Kyle Butts        1y Imputation Estimator f...
#>   8 100 spmoran          0.2.2.9 Daisuke Murakami  8M Fast Spatial Regressio...
#>   9 100 seqHMM           1.2.6   Jouni Helske      5M Mixture Hidden Markov ...
#>  10 100 SQRL             1.0.2   Mike Lee          8d Enhances Interaction w...

# Regular expressions
advanced_search(Author = "/Joh?nathan/")
#> - "advanced search" --------------------------- 255 packages in 0.002 seconds -
#>   #     package        version by                           @ title            
#>   1 100 phonfieldwork  0.0.11  George Moroz                3y Linguistic Pho...
#>   2 100 equatiomatic   0.3.1   Daniel Anderson             2y Transform Mode...
#>   3 100 Sample.Size    1.0     Wei Jiang<wjiang@kumc.edu> 10y Sample size ca...
#>   4 100 onepass        0.1.2   Jonathan Lin                3y 1password Cred...
#>   5 100 knitr          1.45    Yihui Xie                   1M A General-Purp...
#>   6 100 raster         3.6.26  Robert J. Hijmans           2M Geographic Dat...
#>   7 100 xtable         1.8.4   David Scott                 5y Export Tables ...
#>   8 100 tableone       0.13.2  Kazuki Yoshida              2y Create 'Table ...
#>   9 100 bridgesampling 1.1.2   Quentin F. Gronau           3y Bridge Samplin...
#>  10 100 rmcorr         0.6.0   Laura R. Marusich           4M Repeated Measu...

# Fuzzy search
advanced_search(Author = "Johnathan~1")
#> - "advanced search" --------------------------- 257 packages in 0.003 seconds -
#>   #     package    version by                           @ title                
#>   1 100 lda        1.4.2   Jonathan Chang              8y Collapsed Gibbs Sa...
#>   2  98 bootImpute 1.2.1   Jonathan Bartlett           6M Bootstrap Inferenc...
#>   3  98 chords     0.95.4  Jonathan Rosenblatt         7y Estimation in Resp...
#>   4  97 mlmi       1.1.2   Jonathan Bartlett           6M Maximum Likelihood...
#>   5  95 RSeed      0.1.60  Claus Jonathan Fritzemeier  7y Borenstein Analysis  
#>   6  95 UnitCircle 0.1.3   Jonathan Berrisch           5y Check if Roots of ...
#>   7  95 handyplots 1.1.3   Jonathan Schwartz           5y Handy Plots          
#>   8  94 rSHAPE     0.3.2   Jonathan Dench              4y Simulated Haploid ...
#>   9  91 tensor     1.5     Jonathan Rougier           12y Tensor product of ...
#>  10  91 tint       0.1.4   Dirk Eddelbuettel           1y 'tint' is not 'Tufte'