Skip to content

Bedework filter expressions

Mike Douglass edited this page Oct 4, 2013 · 6 revisions

Some notes that can be turned into a guide to writing filter expressions.

General form of expressions

They take the general form of a parenthesized expression, each term being (name operator value). Anding and oring of terms is supported - using the tokens "&" and "|". For example

(((a=b) & (c=d)) | (x=y))

In general the name in a term is an icalendar property name - there are some which are defined by bedework to extend that set. The property names and some attributes are currently defined in

org.bedework.util.calendar.PropertyIndex (edu.rpi.cmt.calendar.PropertyIndex)

Operators

The following are the allowed operators mostly with the usual meanings

  * "=" - equal
  * "!=" - not equal
  * "~" - like (may not work too well)
  * "!~" - not like (may not work too well)
  * ">" - greater than
  * ">=" - greater than or equal
  * "<" - less than
  * "<=" - less than or equal
  * "in" - in time range
  * "isdefined"
  * "notdefined"

Values

The values for most are whatever is valid for that property - expressed as a quoted string will usually work).

Special properties

ENTITY_TYPE

Value is one of "category", "collection", "event", "alarm", "todo", "journal", "freeAndBusy", "vavailability", "available", "vpoll" e.g.

entity_type = "event" will limit to events

Categories

While this is a standard property we handle these in a different way. In the standard a category is an unstructured text value. In bedework they are entities which theoretically have a multi-language display name and a single name. Currently they are being indexed with a manufactured path. If the category name had any "/" delimiters, the part up to the last "/" becomes part of the path. For example

{
      "_index" : "bwpublicp20131004t144512",
      "_type" : "category",
      "_id" : "402881e6-20a21413-0120-a24c742e-00000058",
      "_score" : 1.0, "_source" : {
  "uid" : "402881e6-20a21413-0120-a24c742e-00000058",
  "creator" : "/principals/users/admin",
  "owner" : "/principals/users/public-user",
  "value" : "org/BioMed",
  "name" : "BioMed",
  "colPath" : "/public/categories/org/",
  "path" : "/public/categories/org/BioMed",
  "category" : "org/BioMed"
}

Within an expression categories may be referenced by their uid, value or path.

The property "catuid" indicates that the value is a list of possible category uids - I suggest this list be kept to length one. This form is the only one that works reliably with the current schema.

(catuid = "402881e6-20a21413-0120-a24c742e-00000058")

The property "categories" with a value starting with "/" indicates a path match.

(categories = "/public/categories/org/BioMed")

otherwise it's the category value:

(categories = "org/BioMed")