[Xapian-discuss] searching on individual fields

Olly Betts olly at survex.com
Tue Jul 1 06:36:22 BST 2008


On Fri, Jun 20, 2008 at 03:22:32PM +0200, james cauwelier wrote:
>     $parser->set_stemming_strategy (XapianQueryParser::STEM_ALL, null,
> 'X'.strtoupper($field_name));

As James says, this only takes one parameter.

>     $query[] = '('.$parser->parse_query ($form[$field_name], null,
> 'X'.strtoupper($field_name)).')';

And parse_query()'s second parameter is meant to be a bitmask of flags -
`null' isn't a sensible thing to pass there.

> $query = implode (' AND ', $query);

Umm, XapianQueryParser::parse_query() returns a XapianQuery object,
which you can't (usefully) concatenate with a string.

To combine XapianQuery objects, stick them all in the array $query, and
then:

    $query = new XapianQuery(XapianQuery::OP_AND, $query);

Cheers,
    Olly



More information about the Xapian-discuss mailing list