#community-help

Resolving TS Issue on Id Field and Search Results

TLDR Mubashirullah had issues getting the 'id' field from their schema, which Kishore Nallan explained was due to it being a special identifier in TS 0.22. They recommended creating a 'searchable_id' field.

Powered by Struct AI

2

9
23mo
Solved
Join the chat
Dec 20, 2021 (23 months ago)
Mubashirullah
Photo of md5-cea7a558edb0c66a1c07dfdcf00bc141
Mubashirullah
11:57 AM
I need some help. id is part of the data I want to index so it ends up being in the schema I define for collection. But when I do a collection retrieve, it does not exist. It does exist in search results as part of document.
What type do you recommend for id? I've read something about it needs to be a string.
Also, I don't seem to be getting as much results. I can't seem to understand why that is.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:58 AM
Happy to help. May I know what version of TS you are using?
Mubashirullah
Photo of md5-cea7a558edb0c66a1c07dfdcf00bc141
Mubashirullah
11:59 AM
the latest
11:59
Mubashirullah
11:59 AM
I get this error:
typesense.exceptions.ObjectNotFound: [Errno 404] Could not find a field named id in the schema.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:59 AM
0.22.1?
12:00
Kishore Nallan
12:00 PM
Okay, so in 0.22, the id field can only be filtered on and cannot be searched on.
12:00
Kishore Nallan
12:00 PM
Because the id is a special identifier, and we only store it on disk but not as a searchable string.
12:01
Kishore Nallan
12:01 PM
If you wish to be able to do treat it like a regular string, create another field called searchable_id as a string type and use that for regular operations.

1

Mubashirullah
Photo of md5-cea7a558edb0c66a1c07dfdcf00bc141
Mubashirullah
12:01 PM
Thank you

1