[Xapian-discuss] Parsing fields with phrases.

Olly Betts olly at survex.com
Thu Feb 21 03:02:46 GMT 2013


On Wed, Feb 20, 2013 at 09:15:45PM -0500, Jim Lynch wrote:
> I have the following code:
>
>     my $par =  
> $qp->parse_query($query,Search::Xapian::FLAG_SPELLING_CORRECTION);
>     print LOG "Query $query, par $par\n";
>     my $enq = $xDatabase->enquire( $par );
>
> The output from the LOG file is:
> Query title:"new dolphin", par Xapian::Query(0 * Snew dolphin)

That query description shows a single term: Snew dolphin

This means you set title/S as a boolean prefix, which I doubt is what
you want - titles are better treated as free text fields.

> No results are returned.  If I change the search to title:dolphin it  
> finds a number of hits including one who's title is
> Introducing the New Dolphin  

This means you are indexing the title as free text, so if you change:

$qp->add_boolean_prefix("title", "S");

to:

$qp->add_prefix("title", "S");

then it will probably start working as you want.

Cheers,
    Olly



More information about the Xapian-discuss mailing list