[Xapian-discuss] Multiple filters with PHP? How to?

Olly Betts olly at survex.com
Thu Jan 10 02:37:08 GMT 2008


On Tue, Jan 08, 2008 at 01:25:15PM -0800, athlon athlonf wrote:
> But on a different subject:
> If I want to filter at datetime and string, how should I do that?
> 
>  author = "the author" 

This line isn't not valid PHP...

> $qarray[] = new XapianQuery('Athe author');
> Won't give anything

That creates a query for the *single term* 'Athe author'.

I'm guessing you want to parse it as a user-entered query?  If so, then
use the XapianQueryParser class, like so:

$qp = new XapianQueryParser();
$qp->add_prefix('author', 'A');
$qarray[] = $qp->parse_query('author:(the author)');

You can also pass 'A' as the third parameter of parse_query() to set the
default prefix to 'A' if you have an author text field in your user
interface.

Cheers,
    Olly



More information about the Xapian-discuss mailing list