forked from openkylin/ukui-search
parent
e7676c887a
commit
d9db5ff896
|
@ -126,7 +126,10 @@ void BatchIndexer::basicIndex()
|
|||
}
|
||||
filesNeedIndex = m_cache;
|
||||
qDebug() <<filesNeedIndex.size() << "files need index.";
|
||||
} else if (m_mode == WorkMode::Update || m_mode == WorkMode::Add) {
|
||||
} else if(m_mode == WorkMode::Add) {
|
||||
filesNeedIndex = m_cache;
|
||||
qDebug() <<filesNeedIndex.size() << "files need index.";
|
||||
} else if (m_mode == WorkMode::Update) {
|
||||
QFileInfo info;
|
||||
QMap<std::string, std::string> indexTimes = basicDb.getIndexTimes();
|
||||
qDebug() << indexTimes.size() << "documents recorded";
|
||||
|
@ -136,15 +139,14 @@ void BatchIndexer::basicIndex()
|
|||
filesNeedIndex.append(path);
|
||||
}
|
||||
}
|
||||
if(m_mode == WorkMode::Update && !indexTimes.isEmpty()) {
|
||||
if(!indexTimes.isEmpty()) {
|
||||
qDebug() << indexTimes.size() << "documents need remove.";
|
||||
for(std::string uniqueTerm : indexTimes.keys()) {
|
||||
basicDb.removeDocument(uniqueTerm);
|
||||
}
|
||||
basicDb.commit();
|
||||
}
|
||||
|
||||
qDebug() << filesNeedIndex.size() << "files need index.";
|
||||
qDebug() << filesNeedIndex.size() << "files need update.";
|
||||
}
|
||||
uint allSize = filesNeedIndex.size();
|
||||
Q_EMIT progress(IndexType::Basic, allSize, 0);
|
||||
|
@ -205,6 +207,8 @@ void BatchIndexer::contentIndex()
|
|||
if(!contentDb.open()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(m_mode == WorkMode::Rebuild || m_mode == WorkMode::Add) {
|
||||
for(QString path : m_cache) {
|
||||
info.setFile(path);
|
||||
if(true == suffixMap[info.suffix()] && info.isFile()) {
|
||||
|
@ -213,7 +217,7 @@ void BatchIndexer::contentIndex()
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if(m_mode == WorkMode::Update || m_mode == WorkMode::Add) {
|
||||
} else if(m_mode == WorkMode::Update) {
|
||||
QMap<std::string, std::string> indexTimes = contentDb.getIndexTimes();
|
||||
qDebug() << indexTimes.size() << "documents recorded";
|
||||
for(QString path : m_cache) {
|
||||
|
@ -230,7 +234,7 @@ void BatchIndexer::contentIndex()
|
|||
}
|
||||
}
|
||||
}
|
||||
if(m_mode == WorkMode::Update && !indexTimes.isEmpty()) {
|
||||
if(!indexTimes.isEmpty()) {
|
||||
qDebug() << indexTimes.size() << "documents need remove";
|
||||
for(std::string uniqueTerm : indexTimes.keys()) {
|
||||
contentDb.removeDocument(uniqueTerm);
|
||||
|
@ -239,7 +243,6 @@ void BatchIndexer::contentIndex()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
uint allSize = filesNeedIndex.size();
|
||||
qDebug() << allSize << "files need content index.";
|
||||
Q_EMIT progress(IndexType::Contents, allSize, 0);
|
||||
|
|
Loading…
Reference in New Issue