+ const char *path;
+ notmuch_status_t ret;
+ notmuch_database_t *db;
+ notmuch_message_t *message;
+
+ Data_Get_Notmuch_Database (self, db);
+
+ SafeStringValue (pathv);
+ path = RSTRING_PTR (pathv);
+
+ ret = notmuch_database_find_message_by_filename (db, path, &message);
+ notmuch_rb_status_raise (ret);
+
+ if (message)
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessage, ¬much_rb_message_type, message);
+ return Qnil;
+}
+
+/*
+ * call-seq: DB.get_all_tags() => TAGS
+ *
+ * Returns a list of all tags found in the database.
+ */
+VALUE
+notmuch_rb_database_get_all_tags (VALUE self)
+{
+ notmuch_database_t *db;
+ notmuch_tags_t *tags;
+
+ Data_Get_Notmuch_Database (self, db);
+
+ tags = notmuch_database_get_all_tags (db);
+ if (!tags) {
+ const char *msg = notmuch_database_status_string (db);
+ if (!msg)
+ msg = "Unknown notmuch error";
+
+ rb_raise (notmuch_rb_eBaseError, "%s", msg);
+ }
+ return notmuch_rb_tags_get (tags);
+}
+
+/*
+ * call-seq:
+ * DB.query(query) => QUERY
+ * DB.query(query, sort:, excluded_tags:, omit_excluded:) => QUERY
+ *
+ * Retrieve a query object for the query string 'query'. When using keyword
+ * arguments they are passwed to the query object.
+ */
+VALUE
+notmuch_rb_database_query_create (int argc, VALUE *argv, VALUE self)
+{
+ VALUE qstrv;
+ VALUE opts;