Ticket #206: serialise_query_and_document.patch
File serialise_query_and_document.patch, 3.1 KB (added by , 15 years ago) |
---|
-
include/xapian/query.h
238 238 */ 239 239 bool empty() const; 240 240 241 /** Serialise query into a string. 242 * 243 * The query representation may change between xapian releases: 244 * even between minor versions. The serialisation should not be used 245 * for persistence - it is intended for allowing documents to be 246 * passed between clients and servers which are running the same 247 * version of xapian. 248 */ 249 std::string serialise() const; 250 251 /** Unserialise a query from a string produced by serialise(). 252 */ 253 static Query unserialise(const std::string &s); 254 241 255 /// Return a string describing this object. 242 256 std::string get_description() const; 243 257 -
include/xapian/document.h
194 194 */ 195 195 docid get_docid() const; 196 196 197 /** Serialise document into a string. 198 * 199 * The document representation may change between xapian releases: 200 * even between minor versions. The serialisation should not be used 201 * for persistence - it is intended for allowing documents to be 202 * passed between clients and servers which are running the same 203 * version of xapian. 204 */ 205 std::string serialise() const; 206 207 /** Unserialise a document from a string produced by serialise(). 208 */ 209 static Document unserialise(const std::string &s); 210 197 211 /// Return a string describing this object. 198 212 std::string get_description() const; 199 213 }; -
api/omdocument.cc
27 27 #include "document.h" 28 28 #include "documentvaluelist.h" 29 29 #include "maptermlist.h" 30 #include "serialise.h" 30 31 #include "utils.h" 31 32 32 33 #include <xapian/error.h> … … 199 200 RETURN(internal->get_docid()); 200 201 } 201 202 203 std::string 204 Document::serialise() const 205 { 206 DEBUGAPICALL(std::string, "Document::serialise", ""); 207 return serialise_document(*this); 202 208 } 203 209 210 Document 211 Document::unserialise(const std::string &s) 212 { 213 DEBUGAPICALL_STATIC(Document, "Document::unserialise", s); 214 return unserialise_document(s); 215 } 216 217 } 218 204 219 ///////////////////////////////////////////////////////////////////////////// 205 220 206 221 void -
api/omquery.cc
194 194 } 195 195 196 196 std::string 197 Query::serialise() const 198 { 199 DEBUGAPICALL(std::string, "Xapian::Query::serialise", ""); 200 if (!internal.get()) return ""; 201 return internal->serialise(); 202 } 203 204 Query 205 Query::unserialise(const std::string &s) 206 { 207 DEBUGAPICALL_STATIC(Xapian::Query, "Xapian::Query::unserialise", s); 208 Query result; 209 if (!s.empty()) { 210 result.internal = Xapian::Query::Internal::unserialise(s); 211 } 212 RETURN(result); 213 } 214 215 std::string 197 216 Query::get_description() const 198 217 { 199 218 std::string res("Xapian::Query(");