Changeset View
Changeset View
Standalone View
Standalone View
src/lib/searchstore.cpp
Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Line(s) | 315 | { | |||
---|---|---|---|---|---|
317 | return parser.parseQuery(value, prefix); | 317 | return parser.parseQuery(value, prefix); | ||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | EngineQuery SearchStore::constructEqualsQuery(const QByteArray& prefix, const QString& value) | 320 | EngineQuery SearchStore::constructEqualsQuery(const QByteArray& prefix, const QString& value) | ||
321 | { | 321 | { | ||
322 | // We use the TermGenerator to normalize the words in the value and to | 322 | // We use the TermGenerator to normalize the words in the value and to | ||
323 | // split it into other words. If we split the words, we then add them as a | 323 | // split it into other words. If we split the words, we then add them as a | ||
324 | // phrase query. | 324 | // phrase query. | ||
325 | QStringList terms = TermGenerator::termList(value); | 325 | const QByteArrayList terms = TermGenerator::termList(value); | ||
326 | 326 | | |||
327 | QVector<EngineQuery> queries; | 327 | QVector<EngineQuery> queries; | ||
328 | int position = 1; | 328 | int position = 1; | ||
329 | for (const QString& term : terms) { | 329 | for (const QByteArray& term : terms) { | ||
330 | QByteArray arr = prefix + term.toUtf8(); | 330 | QByteArray arr = prefix + term; | ||
331 | queries << EngineQuery(arr, position++); | 331 | queries << EngineQuery(arr, position++); | ||
332 | } | 332 | } | ||
333 | 333 | | |||
334 | if (queries.isEmpty()) { | 334 | if (queries.isEmpty()) { | ||
335 | return EngineQuery(); | 335 | return EngineQuery(); | ||
336 | } else if (queries.size() == 1) { | 336 | } else if (queries.size() == 1) { | ||
337 | return queries.first(); | 337 | return queries.first(); | ||
338 | } else { | 338 | } else { | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |