redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.06k stars 108 forks source link

Person.find(person.pk == id).first() returns empty even if there is an object #575

Closed Sreesanth46 closed 2 months ago

Sreesanth46 commented 8 months ago

I got this issue when updating a Model and then finding the same model that I updated.

this is my code def get_campaign_by_id_and_client_id(id, client_id): try: return InterviewRedisModel.find( InterviewRedisModel.pk == id, InterviewRedisModel.created_by == client_id ).first() except NotFoundError: raise CampaignNotFoundException("Campaign not found")

First time it returns the object as expected. Next time it raises the exception. But when I do a get() query instead InterviewRedisModel.get(pk = id) This returns even if the find returns empty/NotFoundError

dearkafka commented 8 months ago

check types, for me it was the problem @Sreesanth46 . If you do update or anything like that and alter types (so that they no longer match your model types) your item becomes unsearchable

Sreesanth46 commented 8 months ago

@dearkafka issue was with the number of indexed fields. Solved the issue by reducing the number of indexed fields.

There is still no document specifying the maximum number of indexed fields that we can use in a document.

dearkafka commented 8 months ago

Mamma Mia!

slorello89 commented 3 months ago

The limit is 1024. If you are using lots of text fields, that changes things somewhat (I think the limit is lower -like 128 or something)

slorello89 commented 2 months ago

Going to close this as it's resolved.