mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Use proper path for DeepSearch xapian DB
This commit is contained in:
parent
5a41b3cb37
commit
32014eaac1
@ -21,11 +21,10 @@
|
||||
#include <xapian.h>
|
||||
|
||||
#include "retroshare/rsgxschannels.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
struct DeepSearch
|
||||
{
|
||||
//DeepSearch(const std::string& dbPath) : mDbPath(dbPath) {}
|
||||
|
||||
struct SearchResult
|
||||
{
|
||||
// TODO: Use RsUrl from extra_locators branch instead of plain string
|
||||
@ -43,7 +42,7 @@ struct DeepSearch
|
||||
results.clear();
|
||||
|
||||
// Open the database we're going to search.
|
||||
Xapian::Database db(mDbPath);
|
||||
Xapian::Database db(dbPath());
|
||||
|
||||
// Set up a QueryParser with a stemmer and suitable prefixes.
|
||||
Xapian::QueryParser queryparser;
|
||||
@ -79,7 +78,7 @@ struct DeepSearch
|
||||
|
||||
static void indexChannelGroup(const RsGxsChannelGroup& chan)
|
||||
{
|
||||
Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN);
|
||||
Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN);
|
||||
|
||||
// Set up a TermGenerator that we'll use in indexing.
|
||||
Xapian::TermGenerator termgenerator;
|
||||
@ -121,13 +120,13 @@ struct DeepSearch
|
||||
std::string idTerm("Qretroshare://channel?id=");
|
||||
idTerm += grpId.toStdString();
|
||||
|
||||
Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN);
|
||||
Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN);
|
||||
db.delete_document(idTerm);
|
||||
}
|
||||
|
||||
static void indexChannelPost(const RsGxsChannelPost& post)
|
||||
{
|
||||
Xapian::WritableDatabase db(mDbPath, Xapian::DB_CREATE_OR_OPEN);
|
||||
Xapian::WritableDatabase db(dbPath(), Xapian::DB_CREATE_OR_OPEN);
|
||||
|
||||
// Set up a TermGenerator that we'll use in indexing.
|
||||
Xapian::TermGenerator termgenerator;
|
||||
@ -168,7 +167,11 @@ private:
|
||||
BAD_VALUENO = Xapian::BAD_VALUENO
|
||||
};
|
||||
|
||||
static std::string mDbPath;
|
||||
static const std::string& dbPath()
|
||||
{
|
||||
static const std::string dbDir =
|
||||
RsAccounts::AccountDirectory() + "/deep_search_xapian_db";
|
||||
return dbDir;
|
||||
}
|
||||
};
|
||||
|
||||
std::string DeepSearch::mDbPath = "/tmp/deep_search_xapian_db";
|
||||
|
Loading…
Reference in New Issue
Block a user