Resolving TypeError in Python Client for Synonyms Call
TLDR Albert was getting a TypeError when trying to call "synonyms" in the Python client. Jason provided correct syntax and an example, resolving the issue.
Jul 22, 2021 (28 months ago)
Albert
07:18 PMTypeError("'Synonyms' object is not callable")
when I do something like this
client.collections[args.name].synonyms().upsert('smart-phone-synonyms', synonym)
Can someone help?
Jason
07:55 PMIf so, the syntax is:
Jason
07:55 PMclient.collections(args.name).synonyms().upsert('smart-phone-synonyms', synonym)
Albert
08:17 PMclient.collections(args.name).synonyms.upsert('smart-phone-synonyms', synonym)
Jason
08:20 PM()
for the Python client as wellAlbert
08:23 PMJason
08:42 PMHere's an example:
https://github.com/typesense/typesense-python/blob/d49eb07fbb3579e1655f97faf4717d7fd3217e18/examples/synonym_operations.py#L73-L75
Jason
08:43 PMsynonyms.
not synonyms().
Typesense
Indexed 2786 threads (79% resolved)
Similar Threads
Managing Synonyms in Collection Updates
Jon sought the best practice for persisting synonyms with new alias collection updates. Jason suggested re-uploading synonyms with each update, gave an insight into future plans of shared synonym lists across collections and recommended creating a GitHub issue.
Troubleshooting Indexing Duration in Typesense Import
Alan asked about lengthy indexing times for importing documents to Typesense. Jason suggested various potential causes, including network connectivity and system resources. They later identified the problem to be an error in Alan's code.
Resolving Multilingual Search Function in Typesense Software
Bill is having difficulty with multilingual search functionality in Typesense software. Developer Kishore Nallan suggested setting a language locale and provided a demo build. The build solution had some issues, and after multiple rounds of software updates and troubleshooting, the problem still persists.
Troubleshooting Typesense Connection Issue and Data Retrieval
Felix encountered issues connecting to a server-created typesense and retrieving data collections. Kishore Nallan and Jason provided guidance, highlighting errors in the original code and suggesting changes to the URL and curl command.
Handling Kinesis Stream Event Batching with Typesense
Dui had questions about how to handle Kinesis stream events with Typesense. Kishore Nallan suggested using upsert mode for creation/update and differentiating with logical deletion. After various discussions including identifying and resolving a bug, they finalized to introduce an `emplace` action in Typesense v0.23.