Ticket #205 (closed defect: invalid)

Opened 14 months ago

Last modified 14 months ago

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

Reported by: fabrice.colin Owned by: newbugs
Priority: low Milestone:
Component: Backend-Quartz Version: 1.0.3
Severity: minor Keywords:
Cc: Blocked By:
Operating System: Linux Blocking:

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

Changed 14 months ago by olly

  • status changed from new to closed
  • resolution set to invalid

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.

Changed 14 months ago by trac

  • platform set to Linux

Changed 14 months ago by fabrice.colin

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);

Changed 14 months ago by olly

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.

Changed 14 months ago by fabrice.colin

Noted. Thanks !

Fabrice

Note: See TracTickets for help on using tickets.