[Xapian-discuss] Re: searching and sorting by date

Sungsoo Kim xingshou at gmail.com
Wed Mar 22 20:04:30 GMT 2006


> SELECT ad.id FROM ad WHERE ad.subcategory_id=41 ORDER BY last_posted 
> DESC LIMIT 0,51;
> 
> is this essentially the same in Xapian as querying for subcategory_id = 
> 41 and then using last_posted as the sortKey?  And, like this SQL query, 
> can Xapian return the 50 must recent documents whose subcategory_id == 41?

Yes. You need to index subcategory as a field and set boolean filter in
the query to restrict by subcategory_id.

You can see the example how to set boolean filter at 
http://article.gmane.org/gmane.comp.search.xapian.general/1474

BTW I think you'd better to use MySQL query in the above case because it 
does not include full text search condition. (You might have omitted it 
for simplicity.)

> But I haven't been able to find any further explanation, particularly, 
> what "indexing with prefexes on probablistic terms from certain fields" 
> means.  I tried querying for "subcateogry_id:41" but got no success.

As far as I know we cannot use underscore in the field name because 
query parser does not recognize it as a part of field name.

And I have difficulty with helping you because I don't know how Xapwrap 
indexes documents.


Sungsoo Kim



More information about the Xapian-discuss mailing list