hal_query: Build Query

View source: R/AllGenerics.R

hal_queryR Documentation

Build Query

Description

Build Query

Usage

hal_query(x, ...)

## S3 method for class '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

Arguments

x, y

A character vector or an object of class HALQuery (typically returned by hal_api()).

...

Currently not used.

value

A vector giving the topics to be searched for (see details).

field

A character string specifying the field to search within. If NULL (the default), search within "text".

Value

An object of class HALQuery.

Author(s)

N. Frerebeau

See Also

Other query tools: hal_facet(), hal_filter(), hal_group(), hal_select(), hal_sort()

Examples

library(magrittr)

## Select fields
hal1 <- hal_api() %>% hal_query("asie")
hal1$q

term <- list("japon", "france")
hal2 <- hal_api() %>% hal_query(term, field = "title_t")
hal2$q

term <- list("Journal", c("Histoire", "History"))
hal3 <- hal_api() %>% hal_query(term, field = "title_t")
hal3$q

## Update query
hal4 <- hal_query(hal1, "agricol?")
hal4$q

## Operators
term <- list("Paris", "France", "history") %NOT% list("Texas", "history")
hal5 <- hal_api() %>% hal_query(term %IN% "text")
hal5$q

term <- c("aluminium", "fer") %BY% 3 %IN% "title_t"
hal6 <- hal_api() %>% hal_query(term)
hal6$q

term <- list("ecology" %IN% "title_t", "cell" %IN% "text")
hal7 <- hal_api() %>% hal_query(term)
hal7$q

nfrerebeau/odyssey documentation built on March 30, 2022, 2:51 p.m.