[Xapian-discuss] QueryParser and prefixes
fabrice.colin at gmail.com
Mon Oct 30 14:32:12 GMT 2006
My app uses prefixes for user-defined labels and directory names.
Since these are
case-sensitive, I chose XLABEL and XDIR respectively. Labels and directories
may start with an upper-case, so a ":" is always inserted between the
prefix and the
term itself. These prefixes are mapped with add_boolean_prefix to
"dir" and "label".
Let's imagine I index a document with "XLABEL:xapian". Running 'delve' on the
index afterwards confirms the term is there.
Now, if I pass "label:xapian" to the QueryParser, no results are
returned. It turns
out that the Query object built by QueryParser has the term "XLABELxapian"
instead of "XLABEL:xapian".
On the other hand, if the label starts with an upper-case, ie
"Xapian", the Query
will contain the term "XLABEL:Xapian" as expected, and the document will be
Should the colon character only be used if the term being prefixed starts with a
I have also found that if I search for "dir:/home/fabrice", the Query
object will have terms "dir", "home" and "fabrice" instead of
How I should prefix terms that don't start with a non-alphanumeric character ?
More information about the Xapian-discuss