Further speedups for filebrowser/catalog

This commit is contained in:
Ingo Weyrich
2019-07-27 17:39:16 +02:00
parent 1320791052
commit de963c54de
7 changed files with 159 additions and 85 deletions

View File

@@ -1603,7 +1603,6 @@ BrowserFilter FileCatalog::getFilter ()
anyRankFilterActive || anyCLabelFilterActive || anyEditedFilterActive;
}
filter.multiselect = false;
/*
* Step 2
@@ -1619,7 +1618,6 @@ BrowserFilter FileCatalog::getFilter ()
(anyEditedFilterActive && anyRecentlySavedFilterActive) ||
(anySupplementaryActive && (anyRankFilterActive || anyCLabelFilterActive || anyEditedFilterActive || anyRecentlySavedFilterActive))) {
filter.multiselect = true;
filter.showRanked[0] = anyRankFilterActive ? bUnRanked->get_active () : true;
filter.showCLabeled[0] = anyCLabelFilterActive ? bUnCLabeled->get_active () : true;
@@ -1656,14 +1654,28 @@ BrowserFilter FileCatalog::getFilter ()
//TODO could use date:<value>;iso:<value> etc
// default will be filename
/* // this is for safe execution if getFilter is called before Query object is instantiated
Glib::ustring tempQuery;
tempQuery="";
if (Query) tempQuery = Query->get_text();
*/
filter.queryString = Query->get_text(); // full query string from Query Entry
filter.queryFileName = Query->get_text(); // for now Query is only by file name
Glib::ustring decodedQueryFileName = Query->get_text(); // for now Query is only by file name
// Determine the match mode - check if the first 2 characters are equal to "!="
if (decodedQueryFileName.find("!=") == 0) {
decodedQueryFileName = decodedQueryFileName.substr(2);
filter.matchEqual = false;
} else {
filter.matchEqual = true;
}
// Consider that queryFileName consist of comma separated values (FilterString)
// Evaluate if ANY of these FilterString are contained in the filename
// This will construct OR filter within the queryFileName
filter.vFilterStrings.clear();
const std::vector<Glib::ustring> filterStrings = Glib::Regex::split_simple(",", decodedQueryFileName.uppercase());
for (const auto& entry : filterStrings) {
// ignore empty filterStrings. Otherwise filter will always return true if
// e.g. queryFileName ends on "," and will stop being a filter
if (!entry.empty()) {
filter.vFilterStrings.push_back(entry);
}
}
return filter;
}