Skip to content

Commit

Permalink
Search: Lax separator matching when filtering results
Browse files Browse the repository at this point in the history
Any separator will now match any other separator when filtering search results.

Example: Type "live server" in filter. Currently it would only match "live server". Consequently, if you type "live.server" it will only match "live.server" and not "live server" even though the user likely wants to see both.

With this update any separator now matches any other separator; A space now matches `.` `-` `_`, an underscore also matches a space and a dash, etcetera.

This means that a filter of "live server" will now show "live.server" in the results.

This is a lot more intuitive in my opinion.
  • Loading branch information
ducalex committed Sep 20, 2024
1 parent 1c43286 commit 08dae5f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gui/search/searchjobwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,12 @@ void SearchJobWidget::fillFilterComboBoxes()

void SearchJobWidget::filterSearchResults(const QString &name)
{
const QString pattern = (Preferences::instance()->getRegexAsFilteringPatternForSearchJob()
? name : Utils::String::wildcardToRegexPattern(name));
QString pattern = name;
if (!Preferences::instance()->getRegexAsFilteringPatternForSearchJob())
{
pattern.replace(QRegularExpression(u"[-.\\s_]+"_s), u"[-. _]"_s);
pattern = Utils::String::wildcardToRegexPattern(pattern);
}
m_proxyModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
updateResultsCount();
}
Expand Down

0 comments on commit 08dae5f

Please sign in to comment.