[Xapian-discuss] add_prefix() versus add_boolean_prefix()
Daniel Ménard
Daniel.Menard at ehesp.fr
Tue Oct 28 18:27:25 GMT 2008
Hello,
Until now, I was using QueryParser.add_prefix() for all my fields, but I
realized that some of them were just "filters" and I'm now experimenting
with add_boolean_prefix() for those fields (I'm using xapian core 1.0.8
with php bindings 1.0.8).
If I add a boolean prefix 'A' for the field 'author', a request like
[test author:john author:doe] gives me the following query :
Xapian::Query((test:(pos=1) FILTER (Ajohn OR Adoe)))
which looks good for me.
But if the same request is written like this : [test author:(john doe)],
I get the following query :
Xapian::Query(((test:(pos=1) OR doe:(pos=2)) FILTER A(john))
which looks strange for me ("doe" is not a filter anymore, extra
parenthesis before "john").
A similar problem appear if I try a phrase search: [test author:"john
doe"] gives
Xapian::Query(((test:(pos=1) OR doe:(pos=2)) FILTER A"john))
Is it a bug? (these requests are correctly parsed if add_prefix is used
instead of add_boolean_prefix).
Thanks!
PS: If it can be useful, here is the php script I used for my tests :
<?php
require_once('/lib/xapian/xapian.php');
$request='test author:(john doe)';
$parser=new XapianQueryParser();
$parser->add_prefix('author', 'A');
echo 'with add_prefix : ',
$parser->parse_query($request)->get_description(), "\n";
$parser=new XapianQueryParser();
$parser->add_boolean_prefix('author', 'A');
echo 'with add_boolean_prefix : ',
$parser->parse_query($request)->get_description(), "\n";
?>
--
Daniel Ménard
More information about the Xapian-discuss
mailing list