Sascha Silbe
2009-Oct-17 20:11 UTC
[Xapian-discuss] collapsing by one value and sorting by another
Hi! We're currently using Xapian to speed up searches in the Sugar datastore [1]. Documents (called Journal objects) are identified by a UUID, this is also used as the Xapian document id. For version support (storing multiple versions of the same document) I need to be able to return only the latest entry of a given document (or rather set of documents in Xapian terms - they share a common UUID and are identified by another one, both stored in a Xapian value). Currently we let Xapian sort the match set (sort criteria chosen by user) and only query for the documents we intend to show on screen (parameters first and maxitems). Is there any way to do that (sorting by user-chosen value number) while collapsing according to another value number (the timestamp of the entry)? I've found ways to use several sort keys (i.e. with the 2.+ only used if the first returns equality), but nothing that would allow me to collapse by a different value than the sort uses (values are often non-unique). [1] http://wiki.sugarlabs.org/go/Development_Team/Datastore_Rewrite CU Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 489 bytes Desc: Digital signature URL: <http://lists.xapian.org/pipermail/xapian-discuss/attachments/20091017/93290942/attachment.pgp>
Olly Betts
2009-Oct-17 21:36 UTC
[Xapian-discuss] collapsing by one value and sorting by another
On Sat, Oct 17, 2009 at 10:11:22PM +0200, Sascha Silbe wrote:> I've found ways to use several sort keys (i.e. with the 2.+ only used if > the first returns equality), but nothing that would allow me to collapse > by a different value than the sort uses (values are often non-unique).Just pass a different value slot number for the sorting and collapsing, for example: enquire.set_sort_by_value(1); enquire.set_collapse_key(2); Cheers, Olly