Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#205 closed defect (invalid)

With Quartz, get_metadata() doesn't throw an UnimplementedError

Reported by: Fabrice Colin Owned by: New Bugs
Priority: low Milestone:
Component: Backend-Quartz Version: 1.0.3
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description

When I try to set metadata on an old Quartz index, Database::set_metadata() throws an UnimplementedError ("This backend doesn't implement metadata"). Confusingly, Database::get_metadata() doesn't throw anything and quietly returns an empty string when invoked. I think it would be preferable if Database::get_metadata() threw the same exception as Database::set_metadata(). This may or may not apply to the Remote back-end too, I haven't checked.

Fabrice

Change History (4)

comment:1 by Olly Betts, 17 years ago

Operating System: Linux
Resolution: invalid
Status: newclosed

The current behaviour is as intended - the rationale is that Database::get_metadata() always returns an empty string if no metadata has been set for that key, even if that's because it's not possible to set metadata for any keys with the current backend.

comment:2 by Fabrice Colin, 17 years ago

In that case, may I suggest the following changes are made to database.h ?

Fabrice

--- /usr/include/xapian/database.h 2007-09-29 10:50:27.000000000 +0800 +++ database.h 2007-10-07 18:45:04.000000000 +0800 @@ -291,7 +291,8 @@

  • WritableDatabase::set_metadata() for more information. *
  • If there is no piece of metadata associated with the specified
  • * key, an empty string is returned.

+ * key, or the database type doesn't support metadata, an empty + * string is returned.

*

  • Empty keys are not valid, and specifying one will cause an
  • exception.

@@ -705,6 +706,9 @@

*

+ * + * @exception Xapian::UnimplementedError will be thrown if metadata + * is not available for this database type.

*/

void set_metadata(const std::string & key, const std::string & value);

comment:3 by Olly Betts, 17 years ago

In future, please attach patches - pasting them typically messes up the whitespace so applying requires extra work.

I've made the changes by hand in this case.

comment:4 by Fabrice Colin, 17 years ago

Noted. Thanks !

Fabrice

Note: See TracTickets for help on using tickets.