jarrod roberson
2007-Mar-08 21:32 UTC
[Xapian-discuss] Question about sorting using the Java bindings.
there appears to be only 3 ways to sort using the java bindings. 1) default sort by relevance 2) .setSortForward(boolean) , this appears to try and sort by docid, but it seems to skip some docid's 3) .setSorting(long, int) , what are valid inputs for this?
Olly Betts
2007-Mar-08 21:44 UTC
[Xapian-discuss] Question about sorting using the Java bindings.
On Thu, Mar 08, 2007 at 04:32:08PM -0500, jarrod roberson wrote:> there appears to be only 3 ways to sort using the java bindings.The Java bindings are lagging behind the C++ API here. It's a pain to update the JNI wrappers by hand, and my hope is to move them over to using SWIG which will mean everything gets wrapped, and can then be kept up to date with almost no extra effort.> 1) default sort by relevance > 2) .setSortForward(boolean) , this appears to try and sort by docid, > but it seems to skip some docid'sThis is a wrapper for the precursor to what's now Enquire::set_docid_order() in C++. It specifies the ordering by docid *for two documents which otherwise are equal in the sort order*.> 3) .setSorting(long, int) , what are valid inputs for this?This is a wrapper for the (now deprecated in C++) method Enquire::set_sorting(). The docs for that are here: http://www.xapian.org/docs/apidoc/html/classXapian_1_1Enquire.html Which say: void set_sorting(Xapian::valueno sort_key, int sort_bands, bool sort_by_relevance=false) For compatibility with Xapian 0.8.5 and earlier. Deprecated: This method is now deprecated, use set_sort_by_relevance(), set_sort_by_value(), or set_sort_by_value_then_relevance() instead. set_sorting(KEY, 1) -> set_sort_by_value(KEY) set_sorting(KEY, 1, false) -> set_sort_by_value(KEY) set_sorting(KEY, 1, true) -> set_sort_by_value_then_relevance(KEY) set_sorting(ANYTHING, 0) -> set_sort_by_relevance() set_sorting(Xapian::valueno(-1), ANYTHING) -> set_sort_by_relevance() Looks like Java doesn't wrap the "sort_by_relevance" parameter, and sort_bands is just ignored now, so the meaningful option is: enquire.setSorting(VALUENO, 1) Which is the same as enquire.set_sort_by_value(VALUENO) in C++. The sort uses a string comparison. Cheers, Olly
Jarrod Roberson
2007-Mar-08 22:21 UTC
[Xapian-discuss] Question about sorting using the Java bindings.
On 3/8/07, Olly Betts <olly@survex.com> wrote:<snip lots of helpful information > thanks for the response, one more question. Is there anyway to get a list of all the Terms on a matching document with the Java bindings?