redis / rueidis

A fast Golang Redis client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, etc.
Apache License 2.0
2.34k stars 149 forks source link

adding field projection to om repositories #186

Closed jamshidi799 closed 1 year ago

jamshidi799 commented 1 year ago

hi guys. I have two question

  1. will you accept this feature? it seems easy to modify the parsing algorithm in the Search function and I can handle it
  2. are we have a contribution doc?

thanks

rueian commented 1 year ago

Hi @jamshidi799,

We don't have a contribution doc currently. PRs are just welcome.

However, how would the field projection work with Object Mapping? They seem to have conflicts.

jamshidi799 commented 1 year ago

if we build a query like this:

search.Query(query).Return("6").Identifier("$.id").Identifier("as").Identifier("id").Identifier("$.title").Identifier("as").Identifier("title").Build()

then Redisearch returns this response:

1) "24" 2) "product:59668" 3) .1) "id" 2) "59668" 3) "title" 4) "hello world"

then I think we can use reflection and JSON tag and map response to the object

jamshidi799 commented 1 year ago

I realized the conflict. thanks for your reply