[Xapian-discuss] normal prefix vs. boolean prefix

Olly Betts olly at survex.com
Sun Nov 9 12:21:18 GMT 2008


On Sat, Nov 08, 2008 at 07:33:48AM -0500, Jim Lynch wrote:
> Torsten Foertsch wrote:
> >Assuming:
> >
> >  $qp->add_prefix(normal=>'S');
> >  $qp->add_boolean_prefix(bool=>'S');

While you can do this, I can't see a real situation in which it makes
much sense to.

> >the 2 queries "normal:something AND something else" and "bool:something 
> >AND something else" will give the same result set but possibly with 
> >different ranking. But even the ranking would be the same if the weight 
> >of the "normal:something" part of the first query is set to 0.

Not exactly, since `normal:something' is subject to stemming and
synonyms.  Otherwise, yes since OP_FILTER is just OP_AND but ignoring
weight contributions from one child.

> >Another question, is it possible to do something like the following in 
> >Perl?
> >
> >Xapian::Query q(OP_AND, Xapian::Query(OP_SCALE_WEIGHT, q_title, FACTOR), 
> >q_body);
> >
> >Just a guess:
> >
> >Search::Xapian::Query->new(OP_AND,
> >                           Search::Xapian::Query->new(OP_SCALE_WEIGHT, 
> >                                                      $q_title, 2.5),
> >                           $q_body)

Looks plausible (if FACTOR is 2.5 and you prepend `$q = ' to the Perl
code), but why not just try it and see if it works?

> For efficiency, the search engine first limits the possible set of 
> documents by applying the boolean filters first follow by the search. 

This isn't correct (a "clump" of AND-like operators in the tree is
combined into a single "multi-and" operator internally - that includes
OP_AND, OP_FILTER, OP_PHRASE, and OP_NEAR) but the rest of what Jim said
looked good to me.

Cheers,
    Olly



More information about the Xapian-discuss mailing list