#community-help

API Key Error and Sorting Issue in Java Client

TLDR suraj faced an API key error and sorting issue in their Java code. Kishore Nallan provided guidance, and after rechecking the fields, suraj confirmed that all issues were resolved.

Powered by Struct AI
+11
17
6mo
Solved
Join the chat
Mar 25, 2023 (6 months ago)
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
05:54 AM
can anybody help me on this?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:23 AM
Can you please post the full gist along with client initialisation? Typically this error means a bad API key is used. Check if key has write permissions.
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
07:01 AM
docker run -p 8108:8108 -v/tmp/data:/data typesense/typesense:0.24.0 --data-dir /data --api-key=Hu52dwsas2AdxdE
07:01
suraj
07:01 AM
Have used this in my windows machine
07:01
suraj
07:01 AM
while create=ing client I am passing abive api-key
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:02 AM
I mean the full Java code
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
07:04 AM
07:06
suraj
07:06 AM
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:07 AM
Hmm that looks fine. None of the other endpoints like health works also?
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
07:23 AM
for health - {
"ok": true
}
07:24
suraj
07:24 AM
getting response
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:25 AM
Can you tell me the version of Java client used? I'm afk at the moment, will get back to you later after checking.
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
01:00 PM
API issue is solved however while testing I found out that somehow sorting is not working..Am i using it wrong?
01:01
suraj
01:01 PM
01:01
suraj
01:01 PM
Have added code and response
Mar 26, 2023 (6 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:50 PM
> API issue is solved
What was the issue?

> somehow sorting is not working
Can you elaborate what you are expecting vs what you are getting? You're sorting by ratings_count:desc and I see that the responses are indeed in descending order of the value of the ratings_count field.
Apr 02, 2023 (6 months ago)
suraj
Photo of md5-396118c791d531ff7af8cd473d5b26ff
suraj
06:48 AM
Thanks Kishor, I was checking the wrong field. All issues are sesolved
+11