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

How to search in a list? #47

Open
avico78 opened this issue Apr 24, 2021 · 1 comment
Open

How to search in a list? #47

avico78 opened this issue Apr 24, 2021 · 1 comment

Comments

@avico78
Copy link

avico78 commented Apr 24, 2021

I see a key pointing to list of json :

redis_json_client.jsonset('customers', Path.rootPath(), { "customers": []})

example of insreted json
customer_json:

 {
  "customer_status": "Active",
  "first_name": "Leonard",
  "last_name": "Cohen",
  "customer_no": 1
}

So now I append each of the json as following:

redis_json_client.jsonarrappend('customers', Path('.customers'), customer_json)

I'd like to preform a search finding specific customer_no
I tried something like:

customer_redis = redis_json_client.jsonget('customers', Path('customer_no'),370471789)

Q:
1.The reaosn for creating a list of json is that i'd like to some category collection in redis
,i wonder how bad it effect the performance ,
I could also assign the json as :
key,customer_json instead of key,[customer_json]

2.How could i preform a search for specific json where key holds a list of json as desribe above?

@gkorland
Copy link
Contributor

  1. When searching in an it's O(n) where n is the length of the array, while when you use map it's O(1)
  2. To search for a specific JSON that hold a specific value you'll have to use RediSearch, we are going to release in the next few weeks this capability.

Meanwhile you can this preview docker redislabs/redisearch:feature-search-json

docker run -p 6379:6379 redislabs/redisearch:feature-search-json

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

No branches or pull requests

2 participants