Merge branch '0811-dev' into 'dev-unity'
Fix: Index error when process a whole dir. See merge request kylin-desktop/ukui-search!126
This commit is contained in:
commit
bc877ce406
|
@ -54,7 +54,7 @@ void ConstructDocumentForPath::run() {
|
|||
// }
|
||||
|
||||
QString uniqueterm = QString::fromStdString(FileUtils::makeDocUterm(sourcePath));
|
||||
QString upTerm = QString::fromStdString(FileUtils::makeDocUterm(sourcePath.section("/", 0, -2, QString::SectionIncludeLeadingSep)));
|
||||
QString upTerm = QString::fromStdString("ZEEKERUPTERM" + FileUtils::makeDocUterm(sourcePath.section("/", 0, -2, QString::SectionIncludeLeadingSep)));
|
||||
// qDebug()<<"sourcePath"<<sourcePath.section("/",0,-2,QString::SectionIncludeLeadingSep);
|
||||
// qDebug() << "sourcePath ---------------------------: " << sourcePath;
|
||||
// qDebug() << "sourcePath.section -------------------: " << sourcePath.section("/",0,-2,QString::SectionIncludeLeadingSep);
|
||||
|
@ -115,7 +115,7 @@ void ConstructDocumentForContent::run() {
|
|||
//doc.setUniqueTerm(uniqueterm);
|
||||
doc.setUniqueTerm(FileUtils::makeDocUterm(m_path));
|
||||
//doc.addTerm(upTerm);
|
||||
doc.addTerm(FileUtils::makeDocUterm(m_path.section("/", 0, -2, QString::SectionIncludeLeadingSep)));
|
||||
doc.addTerm("ZEEKERUPTERM" + FileUtils::makeDocUterm(m_path.section("/", 0, -2, QString::SectionIncludeLeadingSep)));
|
||||
doc.addValue(m_path);
|
||||
|
||||
//'\xEF\xBC\x8C' is "," "\xE3\x80\x82" is "。" use three " " to replace ,to ensure the offset info.
|
||||
|
|
|
@ -456,20 +456,27 @@ bool IndexGenerator::deleteAllIndex(QStringList *pathlist) {
|
|||
if(list->isEmpty())
|
||||
return true;
|
||||
try {
|
||||
qDebug() << "--delete start--";
|
||||
for(int i = 0; i < list->size(); i++) {
|
||||
QString doc = list->at(i);
|
||||
std::string uniqueterm = FileUtils::makeDocUterm(doc);
|
||||
qDebug() << "--delete start--";
|
||||
std::string upterm = "ZEEKERUPTERM" + FileUtils::makeDocUterm(doc);
|
||||
|
||||
m_database_path->delete_document(uniqueterm);
|
||||
m_database_content->delete_document(uniqueterm);
|
||||
|
||||
//delete all files under it if it's a dir.
|
||||
m_database_path->delete_document(upterm);
|
||||
m_database_content->delete_document(upterm);
|
||||
qDebug() << "delete path" << doc;
|
||||
qDebug() << "delete md5" << QString::fromStdString(uniqueterm);
|
||||
qDebug() << "--delete finish--";
|
||||
// qDebug() << "delete md5" << QString::fromStdString(uniqueterm);
|
||||
|
||||
// qDebug()<<"m_database_path->get_lastdocid()!!!"<<m_database_path->get_lastdocid();
|
||||
// qDebug()<<"m_database_path->get_doccount()!!!"<<m_database_path->get_doccount();
|
||||
}
|
||||
m_database_path->commit();
|
||||
m_database_content->commit();
|
||||
qDebug() << "--delete finish--";
|
||||
} catch(const Xapian::Error &e) {
|
||||
qWarning() << QString::fromStdString(e.get_description());
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue