Ticket #178: metadata_and_mvcms_register.patch
File metadata_and_mvcms_register.patch, 5.7 KB (added by , 15 years ago) |
---|
-
xapian-core/tests/api_metadata.cc
122 122 } 123 123 124 124 // Test metadata iterators. 125 DEFINE_TESTCASE(metadata5, writable ) {125 DEFINE_TESTCASE(metadata5, writable && !remote) { 126 126 Xapian::WritableDatabase db = get_writable_database(); 127 127 128 128 // Check that iterator on empty database returns nothing. -
xapian-core/tests/harness/testrunner.cc
58 58 "synonyms,replicas,flint" }, 59 59 { "multi_flint", "backend,positional,multi" }, 60 60 { "multi_chert", "backend,positional,valuestats,multi" }, 61 { "remoteprog_flint", "backend,remote,transactions,positional,writable " },62 { "remotetcp_flint", "backend,remote,transactions,positional,writable " },63 { "remoteprog_chert", "backend,remote,transactions,positional,valuestats,writable " },64 { "remotetcp_chert", "backend,remote,transactions,positional,valuestats,writable " },61 { "remoteprog_flint", "backend,remote,transactions,positional,writable,metadata" }, 62 { "remotetcp_flint", "backend,remote,transactions,positional,writable,metadata" }, 63 { "remoteprog_chert", "backend,remote,transactions,positional,valuestats,writable,metadata" }, 64 { "remotetcp_chert", "backend,remote,transactions,positional,valuestats,writable,metadata" }, 65 65 { NULL, NULL } 66 66 }; 67 67 -
xapian-core/net/remoteserver.cc
185 185 &RemoteServer::msg_replacedocumentterm, 186 186 &RemoteServer::msg_deletedocument, 187 187 &RemoteServer::msg_writeaccess, 188 &RemoteServer::msg_getmetadata, 189 &RemoteServer::msg_setmetadata, 188 190 // MSG_GETMSET - used during a conversation. 189 191 // MSG_SHUTDOWN - handled by get_message(). 190 192 }; … … 658 660 659 661 send_message(REPLY_ADDDOCUMENT, encode_length(did)); 660 662 } 663 664 665 void 666 RemoteServer::msg_getmetadata(const string & message) 667 { 668 send_message(REPLY_METADATA, db->get_metadata(message)); 669 } 670 671 void 672 RemoteServer::msg_setmetadata(const string & message) 673 { 674 if (!wdb) 675 throw Xapian::InvalidOperationError("Server is read-only"); 676 const char *p = message.data(); 677 const char *p_end = p + message.size(); 678 size_t keylen = decode_length(&p, p_end, false); 679 string key = string(p, keylen); 680 p += keylen; 681 string val = string(p); 682 wdb->set_metadata(key, val); 683 } -
xapian-core/common/remote-database.h
241 241 const Xapian::Document & document); 242 242 243 243 std::string get_uuid() const; 244 245 string get_metadata(const string & key) const; 246 247 void set_metadata(const string & key, const string & value); 244 248 }; 245 249 246 250 #endif // XAPIAN_INCLUDED_REMOTE_DATABASE_H -
xapian-core/common/remoteprotocol.h
73 73 MSG_REPLACEDOCUMENTTERM, // Replace Document by term 74 74 MSG_DELETEDOCUMENT, // Delete Document 75 75 MSG_WRITEACCESS, // Upgrade to WritableDatabase 76 MSG_GETMETADATA, // get metadata 77 MSG_SETMETADATA, // set metadata 76 78 MSG_GETMSET, // Get MSet 77 79 MSG_SHUTDOWN, // Shutdown 78 80 MSG_MAX … … 100 102 REPLY_VALUE, // Document Value 101 103 REPLY_ADDDOCUMENT, // Add Document 102 104 REPLY_RESULTS, // Results (MSet) 105 REPLY_METADATA, // Metadata 103 106 REPLY_MAX 104 107 }; 105 108 -
xapian-core/common/remoteserver.h
142 142 // replace document with unique term 143 143 void msg_replacedocumentterm(const std::string & message); 144 144 145 // get metadata 146 void msg_getmetadata(const std::string & message); 147 148 // set metadata 149 void msg_setmetadata(const std::string & message); 150 151 145 152 public: 146 153 /** Construct a RemoteServer. 147 154 * -
xapian-core/api/registry.cc
194 194 Xapian::MatchSpy * spy; 195 195 spy = new Xapian::ValueCountMatchSpy(); 196 196 matchspies[spy->name()] = spy; 197 198 Xapian::MatchSpy * mvspy; 199 mvspy = new Xapian::MultiValueCountMatchSpy(); 200 matchspies[mvspy->name()] = mvspy; 197 201 } 198 202 199 203 void -
xapian-core/backends/remote/remote-database.cc
723 723 { 724 724 return uuid; 725 725 } 726 727 728 string 729 RemoteDatabase::get_metadata(const string & key) const 730 { 731 send_message(MSG_GETMETADATA, key); 732 string metadata; 733 get_message(metadata, REPLY_METADATA); 734 return metadata; 735 } 736 737 void 738 RemoteDatabase::set_metadata(const string & key, const string & value) 739 { 740 string data = encode_length(key.size()); 741 data += key; 742 data += value; 743 send_message(MSG_SETMETADATA, data); 744 }