[Xapian-discuss] Prefixes

Fabrice Colin fabrice.colin at gmail.com
Sat Jan 27 04:59:11 GMT 2007


Hi all,

I am using QueryParser::add_boolean_prefix("url", "U") to restrict searches to
documents that have a specific URL.
When the input has a URL containing a space, how should it be quoted ?

For instance, the input url:"file:///some/where/a file" will generate the terms
"U"file:///some/where/a" and "file", and url:'file:///some/where/a
file' will generate
"U'file:///some/where/a" and "file".

I also found that url:'file:///some/where/a file.txt' will generate the terms
"U'file:///some/where/a", "file" and "txt", and not just
"U'file:///some/where/a", "file.txt".
Of course url:file:///some/where/afile.txt only generates
Ufile:///some/where/afile.txt.

This leads me to a second question. At indexing time, long URLs are hashed just
like what omindex does with hash_long_term(). Because of this, the QueryParser
will always generate the wrong term when its input has a filter on one of these
long URLs. Would it be possible to have something like the following ?

void Xapian::QueryParser::add_boolean_prefix(
const std::string &field,
const std::string &prefix,
const TermTransformer *transform);

where transform is a functor that is passed the term the QueryParser extracted
from the input for the given field and modifies that term before the QueryParser
builds the query.

Fabrice



More information about the Xapian-discuss mailing list