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

athlon athlonf athlonkmf at yahoo.com
Thu Jan 10 09:45:39 GMT 2008


>>  author = "the author" 

>This line isn't not valid PHP...

Yes, i know. I was actually asking for the xapian equivalent for such a where clause if it were SQL.
(select * from documents where author="the author")
->
$qarray[] = new XapianQuery('Athe author');


>> $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.

Thanks, that is indeed easier. 
I have a pretty hard time to use the more advanced of xapian due to the lack of examples.
I'll write an article about the setup once I've figured more things out.





      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the Xapian-discuss mailing list