Filter Results
hal_filter(x, ...)
# S3 method for HALQuery
hal_filter(x, value, field = NULL, ...)
An object of class HALQuery
.
Other query tools:
hal_facet()
,
hal_group()
,
hal_query()
,
hal_select()
,
hal_sort()
library(magrittr)
## Simple filer
hal1 <- hal_api() %>% hal_filter("file", "submitType_s")
hal1$fq
#> [1] "submitType_s:file"
## Advanced filter
hal2 <- hal_api() %>% hal_filter(c("THESE", "HDR"), "docType_s")
hal2$fq
#> [1] "docType_s:(THESE OR HDR)"
## Multiple filters
hal3 <- hal_api() %>%
hal_filter("[NOW-1MONTHS/DAY TO NOW/HOUR]", "submittedDate_tdate") %>%
hal_filter("-notice", "submitType_s")
hal3$fq
#> [1] "submittedDate_tdate:[NOW-1MONTHS/DAY TO NOW/HOUR]"
#> [2] "submitType_s:-notice"
## Range filters
hal4 <- hal_api() %>% hal_filter("[2000 TO 2013]", "submittedDateY_i")
hal4$fq
#> [1] "submittedDateY_i:[2000 TO 2013]"
hal5 <- hal_api() %>% hal_filter("[Aa TO Ab]", "city_s")
hal5$fq
#> [1] "city_s:[Aa TO Ab]"