[Xapian-discuss] QueryParser and prefixes
Fabrice Colin
fabrice.colin at gmail.com
Mon Oct 30 14:32:12 GMT 2006
Hi all,
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
found.
Should the colon character only be used if the term being prefixed starts with a
capital ?
I have also found that if I search for "dir:/home/fabrice", the Query
object will have terms "dir", "home" and "fabrice" instead of
"XDIR:/home/fabrice"
or "XDIR/home/fabrice".
How I should prefix terms that don't start with a non-alphanumeric character ?
Cheers.
Fabrice
More information about the Xapian-discuss
mailing list