Commit 8befc8b1 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Only match filePath when filename matched OR pattern has '/'

If filename didn't match, it is highly unlikely that filePath will get
matched. However, if there is a '/' in the pattern, we will match the
path anyways because then we are sure the user is trying to match the
path.

The main reason this is necessary is because matching path is really
slow because paths are long so we try to avoid matching path as much as
we can.
parent 26494998
......@@ -78,9 +78,14 @@ protected:
res = filterByPath(path, score);
} else {
int scorep = 0, scoren = 0;
bool resp = filterByPath(path, scorep);
bool resn = filterByName(name, scoren);
// only match file path if filename got a match
bool resp = false;
if (resn || pattern.contains(QLatin1Char('/'))) {
resp = filterByPath(path, scorep);
}
// store the score for sorting later
score = scoren + scorep;
res = resp || resn;
......
Markdown is supported
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