Ticket #100 (closed enhancement: released)
Allow custom sort orders
| Reported by: | richard | Owned by: | olly |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Library API | Version: | SVN trunk |
| Severity: | minor | Keywords: | |
| Cc: | olly, mhammond | Blocked By: | |
| Operating System: | All | Blocking: |
Description
Xapian should allow sort orders to be implemented by subclassing a base "Match Comparison" class, which compares two MatchItems?.
The attached patch implements this feature. It's a fairly invasive patch, because it is necessary to sort the Document object in the MatchItems? used by the matcher, rather than a single sort key.
The patch works correctly in all cases, as far as I can tell, but still needs some work to improve performance in the case of remote databases. Previously, the mset items passed from the remote database contained the value of the sort-key in a member. However, for the new version, this member is replaced by a document object. At present, this document object is not passed when the mset items are passed, and instead will be requested when the document is accessed (which will probably happen when the items are being merged into the local mset). Instead, the document objects should be passed across with the mset item; or better, the partial document objects should be passed, to avoid needing to access the document data and termlist tables more than necessary.
This issue should probably be fixed before the patch is merged, to avoid a performance-regression. (It would be good to do some general benchmarking before merging this, anyway, for just that reason.)
