Commit f99d93f4 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Bug 333566 - Quick filter in KMail 4.13 stops working with non-Latin...

Bug 333566 - Quick filter in KMail 4.13 stops working with non-Latin characters (Cyrillic Russian Unicode) - search empty result

FIXED-IN: 4.13.1
BUG: 333566
We need to update database
parent 23f86082
......@@ -63,7 +63,7 @@ namespace {
}
}
#define INDEXING_AGENT_VERSION 3
#define INDEXING_AGENT_VERSION 4
BalooIndexingAgent::BalooIndexingAgent(const QString& id)
: AgentBase(id),
......@@ -144,7 +144,7 @@ qlonglong BalooIndexingAgent::indexedItemsInDatabase(const std::string& term, co
{
Xapian::Database db;
try {
db = Xapian::Database(dbPath.toStdString());
db = Xapian::Database(dbPath.toUtf8().constData());
} catch (const Xapian::DatabaseError& e) {
kError() << "Failed to open database" << dbPath << ":" << QString::fromStdString(e.get_msg());
return 0;
......
......@@ -28,7 +28,7 @@
AkonotesIndexer::AkonotesIndexer(const QString& path)
: AbstractIndexer(), m_termGen( 0 )
{
m_db = new Xapian::WritableDatabase(path.toStdString(), Xapian::DB_CREATE_OR_OPEN);
m_db = new Xapian::WritableDatabase(path.toUtf8().constData(), Xapian::DB_CREATE_OR_OPEN);
}
AkonotesIndexer::~AkonotesIndexer()
......
......@@ -32,8 +32,8 @@
EmailIndexer::EmailIndexer(const QString& path, const QString& contactDbPath):
AbstractIndexer(), m_doc( 0 ), m_termGen( 0 )
{
m_db = new Xapian::WritableDatabase(path.toStdString(), Xapian::DB_CREATE_OR_OPEN);
m_contactDb = new Xapian::WritableDatabase(contactDbPath.toStdString(), Xapian::DB_CREATE_OR_OPEN);
m_db = new Xapian::WritableDatabase(path.toUtf8().constData(), Xapian::DB_CREATE_OR_OPEN);
m_contactDb = new Xapian::WritableDatabase(contactDbPath.toUtf8().constData(), Xapian::DB_CREATE_OR_OPEN);
}
EmailIndexer::~EmailIndexer()
......
......@@ -108,19 +108,23 @@ ResultIterator ContactQuery::exec()
if (d->criteria == ExactMatch) {
if (!d->any.isEmpty()) {
m_queries << Xapian::Query(d->any.toStdString());
const QByteArray ba = d->any.toUtf8();
m_queries << Xapian::Query(ba.constData());
}
if (!d->name.isEmpty()) {
m_queries << Xapian::Query("NA" + d->name.toStdString());
const QByteArray ba = "NA" + d->name.toUtf8();
m_queries << Xapian::Query(ba.constData());
}
if (!d->nick.isEmpty()) {
m_queries << Xapian::Query("NI" + d->nick.toStdString());
const QByteArray ba = "NI" + d->nick.toUtf8();
m_queries << Xapian::Query(ba.constData());
}
if (!d->email.isEmpty()) {
m_queries << Xapian::Query(d->email.toStdString());
const QByteArray ba = d->email.toUtf8();
m_queries << Xapian::Query(ba.constData());
}
if (!d->uid.isEmpty()) {
......@@ -131,31 +135,32 @@ ResultIterator ContactQuery::exec()
if (!d->any.isEmpty()) {
Xapian::QueryParser parser;
parser.set_database(db);
m_queries << parser.parse_query(d->any.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->any.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (!d->name.isEmpty()) {
Xapian::QueryParser parser;
parser.set_database(db);
parser.add_prefix("", "NA");
m_queries << parser.parse_query(d->name.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->name.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (!d->nick.isEmpty()) {
Xapian::QueryParser parser;
parser.set_database(db);
parser.add_prefix("", "NI");
m_queries << parser.parse_query(d->nick.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->nick.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
// FIXME: Check for exact match?
if (!d->email.isEmpty()) {
Xapian::QueryParser parser;
parser.set_database(db);
m_queries << parser.parse_query(d->email.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->email.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (!d->uid.isEmpty()) {
......
......@@ -202,7 +202,8 @@ ResultIterator EmailQuery::exec()
// vHanda: Do we really need the query parser over here?
Q_FOREACH (const QString& str, d->involves) {
m_queries << parser.parse_query(str.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = str.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
}
......@@ -210,8 +211,8 @@ ResultIterator EmailQuery::exec()
Xapian::QueryParser parser;
parser.set_database(db);
parser.add_prefix("", "F");
m_queries << parser.parse_query(d->from.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->from.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (!d->to.isEmpty()) {
......@@ -220,7 +221,8 @@ ResultIterator EmailQuery::exec()
parser.add_prefix("", "T");
Q_FOREACH (const QString& str, d->to) {
m_queries << parser.parse_query(str.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = str.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
}
......@@ -230,7 +232,8 @@ ResultIterator EmailQuery::exec()
parser.add_prefix("", "CC");
Q_FOREACH (const QString& str, d->cc) {
m_queries << parser.parse_query(str.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = str.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
}
......@@ -240,7 +243,8 @@ ResultIterator EmailQuery::exec()
parser.add_prefix("", "BC");
Q_FOREACH (const QString& str, d->bcc) {
m_queries << parser.parse_query(str.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = str.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
}
......@@ -249,8 +253,8 @@ ResultIterator EmailQuery::exec()
parser.set_database(db);
parser.add_prefix("", "SU");
parser.set_default_op(Xapian::Query::OP_AND);
m_queries << parser.parse_query(d->subjectMatchString.toStdString(),
const QByteArray ba = d->subjectMatchString.toUtf8();
m_queries << parser.parse_query(ba.constData(),
Xapian::QueryParser::FLAG_PARTIAL);
}
......@@ -271,8 +275,8 @@ ResultIterator EmailQuery::exec()
parser.set_database(db);
parser.add_prefix("", "BO");
parser.set_default_op(Xapian::Query::OP_AND);
m_queries << parser.parse_query(d->bodyMatchString.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray ba = d->bodyMatchString.toUtf8();
m_queries << parser.parse_query(ba.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (d->important == 'T')
......@@ -297,7 +301,8 @@ ResultIterator EmailQuery::exec()
QStringList list = d->matchString.split(QRegExp("\\s"), QString::SkipEmptyParts);
Q_FOREACH (const QString& s, list) {
m_queries << parser.parse_query(s.toStdString(),
const QByteArray ba = s.toUtf8();
m_queries << parser.parse_query(ba.constData(),
Xapian::QueryParser::FLAG_PARTIAL);
}
}
......
......@@ -86,7 +86,8 @@ ResultIterator NoteQuery::exec()
parser.set_database(db);
parser.add_prefix("", "BO");
m_queries << parser.parse_query(d->note.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray baNote = d->note.toUtf8();
m_queries << parser.parse_query(baNote.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
if (!d->title.isEmpty()) {
......@@ -95,7 +96,8 @@ ResultIterator NoteQuery::exec()
parser.add_prefix("", "SU");
parser.set_default_op(Xapian::Query::OP_AND);
m_queries << parser.parse_query(d->title.toStdString(), Xapian::QueryParser::FLAG_PARTIAL);
const QByteArray baTitle = d->title.toUtf8();
m_queries << parser.parse_query(baTitle.constData(), Xapian::QueryParser::FLAG_PARTIAL);
}
Xapian::Query query(Xapian::Query::OP_OR, m_queries.begin(), m_queries.end());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment