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 &lt;<a href="mailto:olly@survex.com">olly@survex.com</a>&gt;:</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>&gt; But for the life of me I can not figure out how to get Omega to do the<br>&gt; sorting by price asc/desc.<br><br>In the scriptindex index description change this line:
<br><br>&gt; 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.&nbsp;&nbsp;A &quot;value&quot; 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.&nbsp;&nbsp;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.&nbsp;&nbsp;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).&nbsp;&nbsp;For
<br>example if property prices are always less than X, you could use X - price.<br><br>&gt; I would love to be able to use the PHP bindings but I can't get my head<br>&gt; around the examples...if someone could give me an basic example on how
<br>&gt; to do the following in PHP it would help a heap!<br>&gt;<br>&gt; The search would be something like this:<br>&gt;<br>&gt; (AND on by default rather than OR)<br>&gt;<br>&gt; address: &quot;fir tree&quot;<br>&gt; countyid: XL19
<br>&gt; sold: XSOLD0<br>&gt; 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.&nbsp;&nbsp;Something like:<br><br>$qp = new_QueryParser();<br>$query = $qp-&gt;parse_query('&quot;fir tree&quot;');
<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query(&quot;XL19&quot;));<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query(&quot;XSOLD0&quot;));<br>$query = new_Query_from_query_pair(Query_OP_FILTER, $query, new_Query(&quot;XUNDER0&quot;));
<br><br>That's assuming you want XSOLD0 AND XUNDER0 - which I guess makes sense<br>if that means &quot;(not sold) and (not under-offer)&quot;.<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>&nbsp;&nbsp;&nbsp;&nbsp;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>