mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-27 06:01:01 +02:00
fix: apply all filters when querying rows by indexed field (#1056)
The indexed query path only used a single index for the Cassandra lookup and ignored any remaining filters. This caused multi-field GraphQL queries to return results matching only the first indexed filter. Post-filter all results against the full filter set after the index lookup, and apply the limit after filtering to avoid short results.
This commit is contained in:
parent
1740e315f4
commit
a0e40950fe
1 changed files with 6 additions and 4 deletions
|
|
@ -286,9 +286,6 @@ class Processor(FlowProcessor):
|
||||||
"""
|
"""
|
||||||
params = [collection, schema_name, index_name, index_value]
|
params = [collection, schema_name, index_name, index_value]
|
||||||
|
|
||||||
if limit:
|
|
||||||
query += f" LIMIT {limit}"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pages = await async_execute_paged(
|
pages = await async_execute_paged(
|
||||||
self.session, query, params
|
self.session, query, params
|
||||||
|
|
@ -296,7 +293,12 @@ class Processor(FlowProcessor):
|
||||||
for page in pages:
|
for page in pages:
|
||||||
for row in page:
|
for row in page:
|
||||||
row_dict = dict(row.data) if row.data else {}
|
row_dict = dict(row.data) if row.data else {}
|
||||||
results.append(row_dict)
|
if self._matches_filters(row_dict, filters, row_schema):
|
||||||
|
results.append(row_dict)
|
||||||
|
if limit and len(results) >= limit:
|
||||||
|
break
|
||||||
|
if limit and len(results) >= limit:
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to query rows: {e}", exc_info=True)
|
logger.error(f"Failed to query rows: {e}", exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue