Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential issue with query-building in Redis OM #542

Open
vladimirberns opened this issue Jul 24, 2023 · 1 comment
Open

Potential issue with query-building in Redis OM #542

vladimirberns opened this issue Jul 24, 2023 · 1 comment

Comments

@vladimirberns
Copy link

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

@slorello89
Copy link
Member

Hi @vladimirberns - can you please share the model this was occuring with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants