The compound_filter function combines two filters into a compound one. These filters can either be compound filters themselves, or single-level filters as described in property_filter. This filter is only meant for use within the query_database function.

compound_filter(x, y, type = "and")

Arguments

x

A property filter; either compound or single-level.

y

A property filter; either compound or single-level.

type

A string indicating what type of compound filter. Must be either "and" or "or".

Value

A structured compound filter.

Details

Compound filters can be nested up to 2 levels deep. Currently there is no checking for this, so it's on the user to adhere to it.

Examples

compound_filter(
  x = property_filter(
    property = "Landmark",
    type = "text",
    body = contains ~ Bridge
  ),
  y = property_filter(
    property = "Bodies of Water",
    type = "checkbox",
    body = equals ~ TRUE
  ),
  type = "and"
)
#> $and
#> $and[[1]]
#> $and[[1]]$property
#> [1] "Landmark"
#> 
#> $and[[1]]$text
#> $and[[1]]$text$contains
#> [1] "Bridge"
#> 
#> 
#> 
#> $and[[2]]
#> $and[[2]]$property
#> [1] "Bodies of Water"
#> 
#> $and[[2]]$checkbox
#> $and[[2]]$checkbox$equals
#> [1] TRUE
#> 
#> 
#> 
#>