Build Query
hal_query(x, ...)
# S3 method for HALQuery
hal_query(x, value, field = NULL, ...)
x %OR% y
x %AND% y
x %NOT% y
x %BY% y
x %IN% y
x %TO% y
An object of class HALQuery
.
Other query tools:
hal_facet()
,
hal_filter()
,
hal_group()
,
hal_select()
,
hal_sort()
library(magrittr)
## Select fields
hal1 <- hal_api() %>% hal_query("asie")
hal1$q
#> [1] "asie"
term <- list("japon", "france")
hal2 <- hal_api() %>% hal_query(term, field = "title_t")
hal2$q
#> [1] "title_t:(japon AND france)"
term <- list("Journal", c("Histoire", "History"))
hal3 <- hal_api() %>% hal_query(term, field = "title_t")
hal3$q
#> [1] "title_t:(Journal AND (Histoire OR History))"
## Update query
hal4 <- hal_query(hal1, "agricol?")
hal4$q
#> [1] "agricol?"
## Operators
term <- list("Paris", "France", "history") %NOT% list("Texas", "history")
hal5 <- hal_api() %>% hal_query(term %IN% "text")
hal5$q
#> [1] "text:(Paris AND France AND history) NOT (Texas AND history)"
term <- c("aluminium", "fer") %BY% 3 %IN% "title_t"
hal6 <- hal_api() %>% hal_query(term)
hal6$q
#> [1] "title_t:\"aluminium fer\"~3"
term <- list("ecology" %IN% "title_t", "cell" %IN% "text")
hal7 <- hal_api() %>% hal_query(term)
hal7$q
#> [1] "(title_t:ecology AND text:cell)"