Xapians! Did anybody wrote and would like to share a routines that parse result from doc.get_data() into some key and pair values in C++ ? Code: Xapian::Document doc = i.get_document(); string data = doc.get_data(); mymap = parse_result(data); As you know the data string contain all the data within the document delimited by "=" sign and "\n" new line and needs to be parse into key and values. I know that we can assign values during indexing and retrieve it as: doc.get_value(1), but I think that this has a overhead and would show to be slower when indexing and retrieving millions of documents. Please correct me if I am wrong, thank you. PS: I don't have any friends so I started http://find1friend.com/ *lol* runs on Xapian! Kevin Duraj
On Wed, Sep 30, 2009 at 03:04:44PM -0700, Kevin Duraj wrote:> Did anybody wrote and would like to share a routines that parse result > from doc.get_data() into some key and pair values in C++ ?Omega has such code: http://trac.xapian.org/browser/trunk/xapian-applications/omega/query.cc#L2060 Cheers, Olly
On Wed, Sep 30, 2009 at 03:04:44PM -0700, Kevin Duraj wrote:> Did anybody wrote and would like to share a routines that parse result > from doc.get_data() into some key and pair values in C++ ?There's code in omega's query.cc (around line 2050 on trunk). However if you're indexing yourself (as well as searching yourself), you may prefer to use another serialisation format for which you have an off-the-shelf library. There's nothing magical about the omega convention for use of document data -- it is purely a convention. (And has some limitations if you want to stuff arbitrary data inside it.) J -- James Aylett talktorex.co.uk - xapian.org - uncertaintydivision.org