summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
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)