EmbeddedJson fields are not able to be sorted on, even with the `sortable=True` flag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
Trying to do something like
result_set = Book.find(
(Book.metrics.score < 3)
).sort_by("metrics.score")
will result in the error that metrics.score is not part of the model even though the find portion works as expected. Since the sort_by function requires a string to look for the - for sort order, I haven't found a way around this. Model can be found here - taken from RU 204 on JSON with OM - @simonprickett anything to add?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the example model in src/python/redis_om_search_example/model.py and reproduce the failing find and sort_by call. Trace sort_by and EmbeddedJson handling for sortable fields; done means sorting by metrics.score works without the model-field error while the existing filtering behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, redis
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100