I noticed somebody wants to use PHP bindings. Well, in the
following magazine (june edition) there is an article that describes
how to use xapian with PHP: <a href="http://www.phparch.com/issue.php?mid=59">http://www.phparch.com/issue.php?mid=59</a><br>
<br>
Have fun,<br>
james<br><br><div><span class="gmail_quote">2006/1/14, Olly Betts <<a href="mailto:olly@survex.com">olly@survex.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, Jan 12, 2006 at 01:25:42PM +0000, John Wards wrote:<br>> But for the life of me I can not figure out how to get Omega to do the<br>> sorting by price asc/desc.<br><br>In the scriptindex index description change this line:
<br><br>> price: field<br><br>to this:<br><br>price: field value=0<br><br>This puts the price in value slot #0 of each document. A "value" is<br>a small piece of data you want fast access to during the match -
e.g.<br>for sorting or collapsing similar documents into a single M-set entry.<br>It doesn't have to be 0, and you can use any number of slots to allow<br>sorting on different criteria.<br><br>And then tell Omega to sort on value 0 by passing CGI parameters:
<br><br>SORT=0<br><br>But beware that the sort is a STRING sort, not numeric. The simple fix<br>is to left pad the price to a suitable width with spaces or zeros.<br><br>In 0.9.2, Omega doesn't allow reverse sorting. The next release
<br>(hopefully out in a few days) will (just pass SORTREVERSE=1 as well<br>as SORT=0).<br><br>The standard workaround for 0.9.2 and earlier is to store a second value<br>carefully constructed to sort the opposite way (say in value 1). For
<br>example if property prices are always less than X, you could use X - price.<br><br>> I would love to be able to use the PHP bindings but I can't get my head<br>> around the examples...if someone could give me an basic example on how
<br>> to do the following in PHP it would help a heap!<br>><br>> The search would be something like this:<br>><br>> (AND on by default rather than OR)<br>><br>> address: "fir tree"<br>> countyid: XL19
<br>> sold: XSOLD0<br>> sold: XUNDER0<br><br>Most of it is going to be identical to the simplesearch.php example,<br>except you want to build a different query. Something like:<br><br>$qp = new_QueryParser();<br>$query = $qp->parse_query('"fir tree"');
<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query("XL19"));<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query("XSOLD0"));<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query("XUNDER0"));
<br><br>That's assuming you want XSOLD0 AND XUNDER0 - which I guess makes sense<br>if that means "(not sold) and (not under-offer)".<br><br>If using the next release, you'd just write new_Query instead of<br>new_Query_from_query_pair (the latter was needed to distinguish
<br>the different Query constructors because SWIG didn't support overloading<br>in PHP bindings, but it does now).<br><br>Cheers,<br> Olly<br><br>_______________________________________________<br>Xapian-discuss mailing list
<br><a href="mailto:Xapian-discuss@lists.xapian.org">Xapian-discuss@lists.xapian.org</a><br><a href="http://lists.xapian.org/mailman/listinfo/xapian-discuss">http://lists.xapian.org/mailman/listinfo/xapian-discuss</a><br>
</blockquote></div><br>