Skip to content

Potential issue with query-building in Redis OM #542

Open
@vladimirberns

Description

@vladimirberns

Hi there, I'm new to Redis. I'm using Redis OM and I'm experiencing an interesting issue. I created a model based off of the JSON response from a web service. It loads data correctly. However, when I call find and pass some criteria, it seems to swap the order of parts of the query randomly. For example, I can call the .find() code and 3 times out of 5 it won't return any results because it forms the query incorrectly. Here is an example from the profiler: Incorrect:

"FT.SEARCH" ":Models.vulnerability.Vulnerabilities:index" "@cve_cvssMetricV31_metrics_cvssData_baseSeverity:{critical}" "LIMIT" "0" "1000"
Correct:

"FT.SEARCH" ":Models.vulnerability.Vulnerabilities:index" "@cve_metrics_cvssMetricV31_cvssData_baseSeverity:{critical}" "LIMIT" "0" "1000"
notice how cvssMetricV31 and metrics are swapped. It's almost as if there's some instantiation issue happening when the models classes are being instantiated.

Update:

I stepped into the resolve_redisearch_query function and it seems like the Parents property is out of order. Is there a way to control the order in which the classes are instantiated? I'm currently doing Vulnerabilities.cve.metrics.cvssMetricV31.cvssData.baseSeverity == 'critical' as my query. I would have thought that would retain the order of the objects, but it seems to randomly move around the order of the Parents

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions