#community-help

Issues with Typesense Search Results and Sorting Method

TLDR Manish expressed an issue with Typesense search results. Upon analysis, Manish realized the results should have been sorted by "ranking" instead of "updated_at".

Powered by Struct AI

1

7
3mo
Solved
Join the chat
Jul 07, 2023 (3 months ago)
Manish
Photo of md5-f0a83cd20895941fd74c026f9f15b61f
Manish
03:30 PM
I'm seeing a strange issue with search results from Typesense. curl <https://druid.struct.ai/v1/search> -XPOST -d '{"q": "sketches"}' -s | jq | less -- the first result seems to have nothing to do with the search term. I'm using 0.25.0.rc41 .
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:42 PM
Could you share all the other search params being sent to Typesense?
03:43
Jason
03:43 PM
And also the schema?
Manish
Photo of md5-f0a83cd20895941fd74c026f9f15b61f
Manish
03:43 PM
2023-07-07T15:43:08.639Z    INFO    search/typesense.go:366    Search Query    {"url": "", "query": {"collection":"threads","exclude_fields":"chats,embedding","filter_by":"org_id := 5M3c && xsr_ids := [3L4f5, 3L4f3]","highlight_fields":"subject,summary,chats","per_page":64,"q":"sketches","query_by":"subject,summary,chats,embedding","sort_by":"updated_at:desc"}}
03:44
Manish
03:44 PM
Schema:

    threadsCol := `{"name": "threads", "fields": [
    {"name": "subject", "type": "string"},
    {"name": "summary", "type": "string"},
    {"name": "chats", "type": "string"},
    {"name": ".*", "type": "auto"},
    {"name": "embedding",
     "type": "float[]",
     "embed": {
       "from": ["subject", "summary", "chats"],
       "model_config": {
         "model_name": "ts/e5-small"
       }
     }
    }
    ]}`
03:45
Manish
03:45 PM
oh shoot. I see a "sort_by": "updated_at:desc" in there -- when this should be sorted by "ranking"
03:45
Manish
03:45 PM
arrr... let me check that up.

1