30 lines
581 B
C++
30 lines
581 B
C++
|
#include "database.h"
|
||
|
|
||
|
using namespace UkuiSearch;
|
||
|
Database::Database(const DataBaseType &type)
|
||
|
{
|
||
|
switch (type) {
|
||
|
case DataBaseType::Basic:
|
||
|
m_database = new Xapian::Database(INDEX_PATH.toStdString());
|
||
|
break;
|
||
|
case DataBaseType::Content:
|
||
|
m_database = new Xapian::Database(CONTENT_INDEX_PATH.toStdString());
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Database::~Database()
|
||
|
{
|
||
|
if(m_database) {
|
||
|
delete m_database;
|
||
|
m_database = nullptr;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
uint Database::getIndexDocCount()
|
||
|
{
|
||
|
return m_database->get_doccount();
|
||
|
}
|