-
Notifications
You must be signed in to change notification settings - Fork 55
MQL Query Language
Kevin Glen Roy Greer edited this page Oct 25, 2021
·
10 revisions
key:value key contains "value"
key=value key exactly matches "value"
key:value1,value2 key contains "value1" OR "value2"
key:(value1|value2) "
key1:value key2:value key1 contains value AND key2 contains "value"
key1:value AND key2:value "
key1:value and key2:value "
key1:value OR key2:value key1 contains value OR key2 contains "value"
key1:value or key2:value "
key:(-value) key does not contain "value"
(expr) groups expression
-expr not expression, ie. -pri:1
NOT expr not expression, ie. NOT pri:1
has:key key has a value
is:key key is a boolean TRUE value
key>value key is greater than value
key-after:value "
key<value key is less than value
key-before:value "
date:YY/MM/DD date specified
date:today date of today
date-after:today-7 date newer than 7 days ago
date:d1..d2 date within range d1 to d2, inclusive
key:me key is the current user
Date formats:
YYYY-MM
YYYY-MM-DD
YYYY-MM-DDTHH
YYYY-MM-DDTHH:MM
StringPStream sps = new StringPStream(); sps.setString(q); PStream ps = sps; ParserContext px = new ParserContextImpl(); ps = parser_.parse(ps, px); if ( ps == null ) { String message = getParsingError(x, q); logger.error(this.getClass().getSimpleName(), "failed to parse q", message); } else { parser_.setX(EmptyX.instance()); Predicate pred = (Predicate) ps.value(); }
try { dao = dao.where(new WebAgentQueryParser(dao.getOf()).parse(x, q)); } catch ( IllegalArgumentException e ) { // thrown when a not null|empty 'q' fails to parse. }
The DigWebAgent (/service/dig) exposes MQL via the Query input field (mapped to form field 'q').
Examples (using regionDAO):
Query | Description |
---|---|
name:Ontario | The name contain the string "Ontario" |
name=Ontario | The name equal to the string "Ontario" |
name=Ontario OR name=Alberta | The name equal to the string "Ontario" or "Alberta" |
id=ON | The id equal to the string "ON" |
id=ON AND name=Ontario | The id equal to the string "ON" and the name equal to the string "Ontario" |
- service/dig?dao=regionDAO&q=name:Ontario
- service/dig?dao=regionDAO&q=name=Ontario
- service/dig?dao=regionDAO&q=name=Ontario%20OR%20name=Alberta
- service/dig?dao=regionDAO&q=id=ON
- service/dig?dao=regionDAO&q=id=ON%20OR%20name=Ontario