* <many>: (WIP) use ~/mu/xapian as the database with an embedded version tag
- add checks in the code to make sure the database is up to date,
if not, warn the user.
This commit is contained in:
@ -29,6 +29,7 @@
|
||||
#include "mu-msg-xapian-priv.hh"
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "mu-util-xapian.h"
|
||||
|
||||
|
||||
static void add_prefix (const MuMsgField* field,
|
||||
@ -132,11 +133,16 @@ mu_query_xapian_new (const char* xpath)
|
||||
g_return_val_if_fail (xpath, NULL);
|
||||
|
||||
if (!mu_util_check_dir (xpath, TRUE, FALSE)) {
|
||||
g_warning ("'%s' is not a readable xapian dir",
|
||||
xpath);
|
||||
g_warning ("'%s' is not a readable xapian dir", xpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mu_util_xapian_db_version_up_to_date (xpath)) {
|
||||
g_warning ("%s is not up-to-date, needs full reindex",
|
||||
xpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mqx = g_new (MuQueryXapian, 1);
|
||||
|
||||
if (!init_mu_query_xapian (mqx, xpath)) {
|
||||
@ -149,6 +155,7 @@ mu_query_xapian_new (const char* xpath)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
mu_query_xapian_destroy (MuQueryXapian *self)
|
||||
{
|
||||
@ -168,6 +175,7 @@ mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
|
||||
g_return_val_if_fail (searchexpr, NULL);
|
||||
|
||||
try {
|
||||
|
||||
Xapian::Query q(get_query(self, searchexpr));
|
||||
Xapian::Enquire enq (*self->_db);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user