| 1 |
Taxonomy query language (tql)
|
| 2 |
-----------------------------
|
| 3 |
|
| 4 |
The taxonomy query language module implements a plugin for
|
| 5 |
the 'search' and 'views' module. It provides a new tab
|
| 6 |
'Taxonomy' in the Drupal search and a new Views filter.
|
| 7 |
|
| 8 |
Use
|
| 9 |
---
|
| 10 |
|
| 11 |
If you have the 'tql' module and the search module enabled,
|
| 12 |
a 'Taxonomy' tab appears in the search where you can enter
|
| 13 |
a search query.
|
| 14 |
|
| 15 |
If you have the 'tql' module and 'Views' enabled, a new
|
| 16 |
filter 'Taxonomy: Query' is available which can be used
|
| 17 |
to enter a query. It works best if it is exposed so users
|
| 18 |
can enter their own query.
|
| 19 |
|
| 20 |
Language capabilities
|
| 21 |
---------------------
|
| 22 |
|
| 23 |
The query language can combine query terms with different
|
| 24 |
operators: AND, OR, XOR and NOT. The operator AND can be
|
| 25 |
omited as it is the default if two terms are listed without
|
| 26 |
operator. The operator NOT can be abbreviated with a dash in
|
| 27 |
front of the term, i.e. '-term'. Brackets can be used to
|
| 28 |
form more complex queries. The following are example queries
|
| 29 |
and their verbose equivalents:
|
| 30 |
|
| 31 |
term1 term2 <=> term1 and term2
|
| 32 |
term1 or -term2 <=> term1 or not term2
|
| 33 |
term1 xor -(term2 -term3) <=> term1 xor not (term2 and not term3)
|
| 34 |
|
| 35 |
Building the lexer and parser
|
| 36 |
-----------------------------
|
| 37 |
|
| 38 |
The module is shipped with a built lexer and parser and you dont
|
| 39 |
need to build it yourself. If you to build it yourself you need
|
| 40 |
the following PEAR packages:
|
| 41 |
|
| 42 |
PEAR: http://pear.php.net/package/PEAR
|
| 43 |
PHP_LexerGenerator: http://pear.php.net/package/PHP_LexerGenerator
|
| 44 |
PHP_ParserGenerator: http://pear.php.net/package/PHP_ParserGenerator
|
| 45 |
|
| 46 |
Install PEAR and put the lexer and parser generators into a directory
|
| 47 |
'PHP' inside the directory 'ast'. Then change to the 'ast' directory
|
| 48 |
and call 'make' to build the lexer and parser.
|
| 49 |
|
| 50 |
|
| 51 |
Authors:
|
| 52 |
mtn: Query language parser
|
| 53 |
rötzi: Drupal integration
|
| 54 |
|