forked from openkylin/ukui-search
Adds support for special symbols in file index and search.
This commit is contained in:
parent
510568b9c5
commit
2d6a208dc4
|
@ -1,3 +1,9 @@
|
|||
ukui-search (0.0.1+0127) v101; urgency=medium
|
||||
|
||||
* Bugs Fixed.
|
||||
|
||||
-- zhangpengfei <zhangpengfei@kylinos.cn> Wed, 27 Jan 2021 14:25:07 +0800
|
||||
|
||||
ukui-search (0.0.1+0126) v101; urgency=medium
|
||||
|
||||
* Bugs Fixed.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "chinese-segmentation.h"
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
|
||||
//extern QList<Document> *_doc_list_path;
|
||||
//extern QMutex _mutex_doc_list_path;
|
||||
|
@ -25,11 +26,6 @@ void ConstructDocumentForPath::run()
|
|||
// qDebug()<<_doc_list_path->size();
|
||||
QString index_text = m_list.at(0);
|
||||
QString sourcePath = m_list.at(1);
|
||||
index_text = index_text.replace(""," ");
|
||||
index_text = index_text.simplified();
|
||||
|
||||
//不带多音字版
|
||||
// QString pinyin_text = FileUtils::find(QString(list.at(0)).replace(".","")).replace("", " ").simplified();
|
||||
|
||||
//多音字版
|
||||
//现加入首字母
|
||||
|
@ -47,10 +43,19 @@ void ConstructDocumentForPath::run()
|
|||
doc.setUniqueTerm(uniqueterm);
|
||||
doc.addTerm(upTerm);
|
||||
doc.addValue(m_list.at(2));
|
||||
QStringList temp;
|
||||
temp.append(index_text);
|
||||
temp.append(pinyin_text_list);
|
||||
doc.setIndexText(temp);
|
||||
/* QStringList temp;
|
||||
// temp.append(index_text);
|
||||
temp.append(pinyin_text_list)*/;
|
||||
doc.setIndexText(pinyin_text_list);
|
||||
int postingCount = 0;
|
||||
while(postingCount < index_text.size())
|
||||
{
|
||||
QVector<size_t> p;
|
||||
p.append(postingCount);
|
||||
doc.addPosting(QUrl::toPercentEncoding(index_text.at(postingCount)).toStdString(),p);
|
||||
++postingCount;
|
||||
}
|
||||
|
||||
// QMetaObject::invokeMethod(m_indexGenerator,"appendDocListPath",Q_ARG(Document,doc));
|
||||
_mutex_doc_list_path.lock();
|
||||
_doc_list_path->append(doc);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QtConcurrent>
|
||||
#include <QThread>
|
||||
#include <chinese-segmentation.h>
|
||||
#include <QUrl>
|
||||
#include "file-searcher.h"
|
||||
#include "global-settings.h"
|
||||
|
||||
|
@ -222,7 +223,7 @@ Xapian::Query FileSearcher::creatQueryForFileSearch(QString keyword, Xapian::Dat
|
|||
std::vector<Xapian::Query> v;
|
||||
for(int i=0;i<userInput.size();i++)
|
||||
{
|
||||
v.push_back(Xapian::Query(QString(userInput.at(i)).toStdString()));
|
||||
v.push_back(Xapian::Query(QUrl::toPercentEncoding(userInput.at(i)).toStdString()));
|
||||
// qDebug()<<QString::fromStdString(Xapian::Query(QString(userInput.at(i)).toStdString()).get_description());
|
||||
}
|
||||
Xapian::Query queryPhrase =Xapian::Query(Xapian::Query::OP_PHRASE, v.begin(), v.end());
|
||||
|
|
Loading…
Reference in New Issue