Ruled out duplicates when searching.
This commit is contained in:
parent
33b84e3100
commit
da5ff47396
|
@ -102,6 +102,12 @@ search_all(const vector<Database::entry> &entries, string expression)
|
|||
bool matched_description = true;
|
||||
bool matched_fulltext = true;
|
||||
|
||||
const auto it = find(result.begin(), result.end(), entry);
|
||||
if (it != result.end())
|
||||
{ // Skip if already in result list.
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const string &term : terms_or)
|
||||
{
|
||||
if (entry.title.find(term) == std::string::npos)
|
||||
|
|
|
@ -63,6 +63,16 @@ Database::operator bool() const
|
|||
return _connected;
|
||||
}
|
||||
|
||||
bool operator ==(const Database::entry &a, const Database::entry &b)
|
||||
{
|
||||
if (a.datetime == b.datetime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const string Database::entry::fulltext_oneline() const
|
||||
{
|
||||
return regex_replace(fulltext, regex("\n"), "\\n");
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
string description;
|
||||
string fulltext;
|
||||
|
||||
friend bool operator ==(const Database::entry &a,
|
||||
const Database::entry &b);
|
||||
//! The full text in one line.
|
||||
const string fulltext_oneline() const;
|
||||
} entry;
|
||||
|
|
Loading…
Reference in New Issue