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
This commit is contained in:
William Wilgus 2022-02-25 21:34:29 -05:00
parent bba0564ec1
commit 836616b937

View file

@ -1495,14 +1495,18 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs,
struct tagcache_search_clause *clause)
{
int i;
int clause_count = tcs->clause_count;
if (tcs->clause_count >= TAGCACHE_MAX_CLAUSES)
if (clause_count >= TAGCACHE_MAX_CLAUSES)
{
logf("Too many clauses");
return false;
}
if (clause->type != clause_logical_or)
{
/* BUGFIX OR'd clauses seem to be mishandled once made into a filter */
if (clause_count <= 1 || tcs->clause[clause_count - 1]->type != clause_logical_or)
{
/* Check if there is already a similar filter in present (filters are
* much faster than clauses).
@ -1510,8 +1514,11 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs,
for (i = 0; i < tcs->filter_count; i++)
{
if (tcs->filter_tag[i] == clause->tag)
{
return true;
}
}
}
if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0)
{