summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-02-25 21:34:29 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2022-02-25 22:04:49 -0500
commit836616b937889db46500e5791de075247386be2d (patch)
treedd2b4bec9755b68862e7fce06919a9d054859fc5 /apps
parentbba0564ec161fd23f614b4c4da00da4a5e414615 (diff)
downloadrockbox-836616b937889db46500e5791de075247386be2d.tar.gz
rockbox-836616b937889db46500e5791de075247386be2d.zip
Tagcache Don't create filters when parsing a logical OR
if possible search clauses are converted to filters once a logical OR is added to the mix (CLAUSE1|CLAUSE2 & CLAUS3)) if CLAUSE1,2 are database non-numeric tags they get made into filters but the logical OR gets carried to the next CLAUSE Rather than trying to figure this out just keep all clauses around a logical OR Change-Id: I03e064e7f897033c5d47d78a1d34238217cde485
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index fc06005c1d..9719e4e651 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1495,8 +1495,9 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs,
1495 struct tagcache_search_clause *clause) 1495 struct tagcache_search_clause *clause)
1496{ 1496{
1497 int i; 1497 int i;
1498 int clause_count = tcs->clause_count;
1498 1499
1499 if (tcs->clause_count >= TAGCACHE_MAX_CLAUSES) 1500 if (clause_count >= TAGCACHE_MAX_CLAUSES)
1500 { 1501 {
1501 logf("Too many clauses"); 1502 logf("Too many clauses");
1502 return false; 1503 return false;
@@ -1504,13 +1505,19 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs,
1504 1505
1505 if (clause->type != clause_logical_or) 1506 if (clause->type != clause_logical_or)
1506 { 1507 {
1507 /* Check if there is already a similar filter in present (filters are 1508 /* BUGFIX OR'd clauses seem to be mishandled once made into a filter */
1508 * much faster than clauses). 1509 if (clause_count <= 1 || tcs->clause[clause_count - 1]->type != clause_logical_or)
1509 */
1510 for (i = 0; i < tcs->filter_count; i++)
1511 { 1510 {
1512 if (tcs->filter_tag[i] == clause->tag) 1511 /* Check if there is already a similar filter in present (filters are
1513 return true; 1512 * much faster than clauses).
1513 */
1514 for (i = 0; i < tcs->filter_count; i++)
1515 {
1516 if (tcs->filter_tag[i] == clause->tag)
1517 {
1518 return true;
1519 }
1520 }
1514 } 1521 }
1515 1522
1516 if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0) 1523 if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0)