Filter Results
Usage
hal_filter(query, ...)
# S3 method for class 'HALQuery'
hal_filter(query, value, field = NULL, ...)Arguments
- query
- An object of class - HALQuery(typically returned by- hal_query()).
- ...
- Currently not used. 
- value
- A - characterstring specifying the value to be used to filter the results.
- field
- A - characterstring specifying the field to filter along.
Value
An object of class HALQuery.
Examples
## Simple filer
hal_query() |> hal_filter("file", "submitType_s")
#> $q
#> [1] "text:*"
#> 
#> $fl
#> [1] "docid,label_s"
#> 
#> $wt
#> [1] "json"
#> 
#> $fq
#> [1] "submitType_s:file"
#> 
#> attr(,"class")
#> [1] "HALQuery"
## Advanced filter
hal_query() |> hal_filter("THESE" %OR% "HDR", "docType_s")
#> $q
#> [1] "text:*"
#> 
#> $fl
#> [1] "docid,label_s"
#> 
#> $wt
#> [1] "json"
#> 
#> $fq
#> [1] "docType_s:THESE OR HDR"
#> 
#> attr(,"class")
#> [1] "HALQuery"
## Multiple filters
hal_query() |>
  hal_filter("NOW-1MONTHS/DAY" %TO% "NOW/HOUR", "submittedDate_tdate") |>
  hal_filter("-notice", "submitType_s")
#> $q
#> [1] "text:*"
#> 
#> $fl
#> [1] "docid,label_s"
#> 
#> $wt
#> [1] "json"
#> 
#> $fq
#> [1] "submittedDate_tdate:[NOW-1MONTHS/DAY TO NOW/HOUR]"
#> [2] "submitType_s:-notice"                             
#> 
#> attr(,"class")
#> [1] "HALQuery"
## Range filters
hal_query() |> hal_filter(2000 %TO% 2013, "submittedDateY_i")
#> $q
#> [1] "text:*"
#> 
#> $fl
#> [1] "docid,label_s"
#> 
#> $wt
#> [1] "json"
#> 
#> $fq
#> [1] "submittedDateY_i:[2000 TO 2013]"
#> 
#> attr(,"class")
#> [1] "HALQuery"
hal_query() |> hal_filter("Aa" %TO% "Ab", "city_s")
#> $q
#> [1] "text:*"
#> 
#> $fl
#> [1] "docid,label_s"
#> 
#> $wt
#> [1] "json"
#> 
#> $fq
#> [1] "city_s:[Aa TO Ab]"
#> 
#> attr(,"class")
#> [1] "HALQuery"