[Xapian-discuss] xapian 1.0.0 / 1.0.1 fatal problem

Alexander Lind malte at webstay.org
Tue Jun 12 23:44:00 BST 2007


Ok, my problem turns out to be related to the Z prefix that has to do 
with the new term generation strategy in Xapian 1.x, if I understand 
things correctly.

This is shortened down example of what worked for me in Xapian 0.9.x, 
but doesn't work in 1.0.x:

[snip]
             // $this->index and $this->stem are already set
            $terms = "love";
   
            $query_parser = new XapianQueryParser();
            $query_parser->set_stemmer($this->stem);
            $query_parser->set_stemming_strategy(QueryParser_STEM_ALL);

            $query = $query_parser->parse_query($terms, 
QueryParser_FLAG_BOOLEAN|QueryParser_FLAG_PHRASE|QueryParser_FLAG_LOVEHATE);
            $enquire = new XapianEnquire($this->index);
           
            $enquire->set_query($query);
            $result = $enquire->get_mset(0, 10);
           
            print "Performing query `" . $query->get_description() . "'\n";
[/snip]


The difference is demonstrated by the last print statement. With 0.9.x, 
it prints:
/Performing query `Xapian::Query(love)'/

With 1.0.x it prints
/Performing query `Xapian::Query(Zlove)'

/There is probably a good reason for this new behavior, but it did have 
me scratching my head for a while :)  Is it supposed to be like this, or 
is it a bug?
In the new simplesearch.php5 example, the query object is created like so:

$query = new XapianQuery(XapianQuery::OP_OR, $terms);

And when using that things work, ie no Z prefixing the query in the 
query description.

Cheers
Alec


More information about the Xapian-discuss mailing list