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

athlon athlonf athlonkmf at yahoo.com
Tue Jan 8 18:59:42 GMT 2008


I've managed to use a single filter on xapian with php, but how can I add extra filters?

For instance. I have these values for the indexscript:
tid : unique=Q boolean=Q field=id
title : unhtml weight=10 field=title index=S  index
category_id : indexnopos=G field=category_id
starter_name: unhtml indexnopos=A field=author
starter_id: index=XAUTHORID field=authorid
last_poster_name: unhtml indexnopos=XLASTAUTHOR field=last_poster_name
last_poster_id: field=last_poster_id
modtime :  field=modtime
url :  field=url
state : field=state

-------------------------

When I make a query with 1 filtering, it works fine. This will show all urls with the search term in the category 68:


$query_string = $_POST['terms'];

$query = $qp->parse_query($query_string);

$queryarr[] = new XapianQuery(XapianQuery_OP_FILTER,$query, new XapianQuery('G68'));
$query = new XapianQuery(XapianQuery_OP_AND,$query);

print "Parsed query is: " . $query->get_description(). "<br/>";


	



			
Parsed query is: Xapian::Query((Zandi:(pos=1) FILTER G68))

---------------------------
But what I want is to make a query filtering author, and category_id.

I tried this and expect to have the results on category 68 with author 5. 

$query_string = $_POST['terms'];
$query = $qp->parse_query($query_string);
$queryarr[] = new XapianQuery(XapianQuery_OP_FILTER,$query, new XapianQuery('G68'));
$queryarr[] = new XapianQuery(XapianQuery_OP_FILTER,$query, new  XapianQuery('XAUTHORID5'));
$query = new XapianQuery(XapianQuery_OP_AND,$queryarr);
print "Parsed query is: " . $query->get_description(). "<br/>";




However, I get no result. Anyone got a clue?



      ____________________________________________________________________________________
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