1
0
Fork 0
mirror of https://github.com/subsurface/subsurface.git synced 2025-02-19 22:16:15 +00:00

fulltext: remember original query

So far, the fulltext-query structure only saves an canonicalized
upper-cased version of the query. However, if we want to save the
fulltext query to the log (filter presets) or want to restore an old
fulltext query, we have to store the original query. We don't want
to confront the user with the mangled upper-cased version.
Therefore, also save the original version.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-05-29 08:26:38 +02:00 committed by Dirk Hohndel
parent 0f4154bacc
commit 0b7ba19775
2 changed files with 2 additions and 0 deletions

View file

@ -278,6 +278,7 @@ FullTextResult FullText::find(const FullTextQuery &q, StringFilterMode mode) con
FullTextQuery &FullTextQuery::operator=(const QString &s)
{
originalQuery = s;
words.clear();
tokenize(s, words);
return *this;

View file

@ -45,6 +45,7 @@ enum class StringFilterMode {
// A fulltext query. Basically a list of normalized words we search for
struct FullTextQuery {
std::vector<QString> words;
QString originalQuery; // Remember original query, which will be written to the log
FullTextQuery &operator=(const QString &); // Initialize by assigning a user-provided search string
bool doit() const; // true if we should to a fulltext search
};