[Xapian-discuss] check for blacklisted words (and thanks)
Alessandro Pasotti
apasotti at gmail.com
Wed May 21 10:54:07 BST 2008
2008/5/21 James Aylett <james-xapian at tartarus.org>:
> On Wed, May 21, 2008 at 09:23:28AM +0200, Alessandro Pasotti wrote:
>
>> Now the question: I must check if a particular document contains
>> blacklisted words (which are in a textfile, unstemmed one per line),
>> is there a way to restrict a query to a single document and return a
>> boolean value if one of the terms in the query are contained in the
>> checked document?
>
> If you want the blacklist to work unstemmed, and are using the
> QueryParser, you can construct a new Query using
> QueryParser::unstem_begin() and QueryParser::unstem_end(), OP_OR them
> all together, and then OP_FILTER with a special (probably prefixed)
> term that's only in the blacklist document. You'll get back nothing,
> or the blacklist document.
>
Thanks for pointing me in the right direction, since I want to
restrict the query to check a particular document, I've added to the
document term list a term with the document ID and I'm now doing a
normal query using the whole blacklist file as the query string on a
sub query with document ID and check for 1 or 0 results, so far so
good.
--
Alessandro Pasotti
w3: www.itopen.it
More information about the Xapian-discuss
mailing list