|
From: <cn...@us...> - 2024-07-15 00:26:23
|
Revision: 1494
http://sourceforge.net/p/seq/svn/1494
Author: cn187
Date: 2024-07-15 00:26:20 +0000 (Mon, 15 Jul 2024)
Log Message:
-----------
Fix up filter string logic for edge cases with equipment fields
Modified Paths:
--------------
showeq/branches/cn187_devel/src/filtermgr.cpp
Modified: showeq/branches/cn187_devel/src/filtermgr.cpp
===================================================================
--- showeq/branches/cn187_devel/src/filtermgr.cpp 2024-07-14 17:11:08 UTC (rev 1493)
+++ showeq/branches/cn187_devel/src/filtermgr.cpp 2024-07-15 00:26:20 UTC (rev 1494)
@@ -946,14 +946,16 @@
{
//info subfields need special handling
bool info_added = false;
+ bool info_wildcard = false;
for (int info_field = IFSF_Light; info_field < IFSF_Max; ++info_field)
{
QString subfield_name = InfoFilterStringFieldName[info_field];
if (!map->contains(subfield_name) || !(*map)[subfield_name].trimmed().length())
{
- if (has_first_match && !wildcard)
+ if (!info_wildcard)
{
- wildcard = true;
+ seqInfo("%s not in map, setting info wildcard", subfield_name.toLatin1().data());
+ info_wildcard = true;
}
continue;
}
@@ -961,24 +963,61 @@
QString value = (*map)[subfield_name];
value = value.trimmed();
- has_first_match = true;
if (!info_added)
{
- filterString += "Info:";
+ if (wildcard)
+ {
+ wildcard = false;
+ filterString += ".*:Info:";
+ }
+ else
+ {
+ filterString += "Info:";
+ }
info_added = true;
}
- if (wildcard)
+ if (info_wildcard)
{
- wildcard = false;
- filterString += ".*";
+ info_wildcard = false;
+ // we need to handle 2 cases here
+ // 1. match-field ignore-field match-field
+ // 2. match-field matchfield
+ // If we naively insert .* like we do elsewhere, we'll
+ // wind up with " .* " which will never match case 2.
+ // But we also don't want to just not include spaces
+ // in the match, because we don't want to accidentally
+ // match a different field/value (especially with short
+ // field names like C or A.
+ if (filterString.length() && filterString.back() == ' ')
+ {
+ filterString = filterString.chopped(1);
+ filterString += "( | .* )";
+ }
+ else
+ {
+ filterString += ".*";
+ }
}
+
filterString += subfield_name;
filterString += ":";
filterString += value;
filterString += " ";
}
- filterString += ":";
+ //end of Info loop, tidy up
+ if (info_added)
+ {
+ if (info_wildcard)
+ {
+ info_wildcard = false;
+ filterString += ".*:";
+ }
+ else
+ {
+ filterString += ":";
+ }
+ }
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|