forked from len0rd/rockbox
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:
parent
bba0564ec1
commit
836616b937
1 changed files with 14 additions and 7 deletions
|
|
@ -1495,14 +1495,18 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs,
|
||||||
struct tagcache_search_clause *clause)
|
struct tagcache_search_clause *clause)
|
||||||
{
|
{
|
||||||
int i;
|
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");
|
logf("Too many clauses");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clause->type != clause_logical_or)
|
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
|
/* Check if there is already a similar filter in present (filters are
|
||||||
* much faster than clauses).
|
* 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++)
|
for (i = 0; i < tcs->filter_count; i++)
|
||||||
{
|
{
|
||||||
if (tcs->filter_tag[i] == clause->tag)
|
if (tcs->filter_tag[i] == clause->tag)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0)
|
if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue