[Xapian-devel] 回复: about sort_by_value
没有锂称
373784273 at qq.com
Wed Mar 26 03:52:57 GMT 2014
Thank you very much for your reply. My English is not very good, maybe I did not describe the problem clearly.
I need to return 10 results, but Circulation of 16800 times in the code,so it is time-consuming.
Can a one-time reading all the value, sort later return to the previous 10?
I'm using version 1.2.17. my code like this:
Index:
for (int i = 0; i <16800; i + +) {
Xapian :: Document doc;
char buf [256];
snprintf (buf, sizeof (buf), "% d", i);
doc.add_term ("term");
doc.add_value (200, buf);
docid = db.add_document (doc);
}
Search:
Xapian :: Database db ("../Data..");
Xapian :: Enquire eq (db);
Xapian :: Query query ("term");
eq.set_sort_by_value (200);
eq.set_query (query);
boost :: timer :: cpu_timer st;
Xapian :: MSet mset = eq.get_mset (0, 10);
In my actual code, also used the AND, and database is 25G, so consuming 25ms.
How to use, can make sorting faster? thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20140326/5e832faf/attachment.html>
More information about the Xapian-devel
mailing list