Hi, I would like to search for filenames in a xapian database. For now my query for "foo-bar.po" turns into the following: Xapian::Query((foo:(pos=1) PHRASE 3 bar:(pos=2) PHRASE 3 po:(pos=3))) This query is successful, if I used the term generator to tokenize "foo-bar.po" during indexing. The problem is: this workaround makes it impossible to distinguish between "foo-bar.po" and "foo/bar.po". A similar problem was described here: http://grokbase.com/topic/2006/08/07/xapian-discuss-search-with-symbols-causes-search-time-to-hemorrhage/oO3ndMNfB_B9PY-NntCHJT9STto But I couldn't follow the link to the bug database (http://www.xapian.org/cgi-bin/bugzilla/show_bug.cgi?id=22), since bugzilla seems to be unavailable at the moment. My question: is there any way to protect special characters in a query? thanks for your time, Lars
James Aylett
2008-Apr-02 07:37 UTC
[Xapian-discuss] Using special characters in query terms
On Wed, Apr 02, 2008 at 05:56:57AM +0200, Lars Kruse wrote:> My question: is there any way to protect special characters in a query?Briefly: you probably need to avoid both TermGenerator and QueryParser, and roll your own to get complete control over how you generate terms out of document and query text. Queries themselves don't care how you construct the terms. J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james at tartarus.org uncertaintydivision.org