{"id":16544574,"url":"https://github.com/devtud/aio_typesense","last_synced_at":"2025-10-28T15:31:14.089Z","repository":{"id":57409208,"uuid":"327956815","full_name":"devtud/aio_typesense","owner":"devtud","description":"Asyncio Library for Typesense","archived":false,"fork":false,"pushed_at":"2021-01-09T15:16:06.000Z","size":32,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-22T09:12:20.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devtud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-08T16:35:41.000Z","updated_at":"2023-10-16T08:56:46.000Z","dependencies_parsed_at":"2022-09-26T17:10:34.630Z","dependency_job_id":null,"html_url":"https://github.com/devtud/aio_typesense","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtud%2Faio_typesense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtud%2Faio_typesense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtud%2Faio_typesense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtud%2Faio_typesense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devtud","download_url":"https://codeload.github.com/devtud/aio_typesense/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859279,"owners_count":16556036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T19:03:26.518Z","updated_at":"2025-10-28T15:31:13.734Z","avatar_url":"https://github.com/devtud.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Tests](https://github.com/devtud/aio_typesense/workflows/Tests/badge.svg)](https://github.com/devtud/aio_typesense/actions?workflow=Tests)\n[![Codecov](https://codecov.io/gh/devtud/aio_typesense/branch/main/graph/badge.svg)](https://codecov.io/gh/devtud/aio_typesense)\n![pypi](https://img.shields.io/pypi/v/aio_typesense.svg)\n![versions](https://img.shields.io/pypi/pyversions/aio_typesense.svg)\n[![](https://pypip.in/license/aio_typesense/badge.svg)](https://pypi.python.org/pypi/aio_typesense)\n\n# aio_typesense\n## Async Library for Typesense with type hints\n\n```bash\npip install aio_typesense\n```\n\n## Usage\n\n```python\n# examples/example.py\n\nimport asyncio\nfrom typing import TypedDict, List\n\nfrom aio_typesense import Client, Collection\n\n\nclass Movie(TypedDict):\n    id: str\n    name: str\n    year: int\n\n\nMOVIES: List[Movie] = [\n    {\"id\": \"id1\", \"name\": \"Wonder Woman\", \"year\": 2017, \"year_facet\": \"2017\"},\n    {\"id\": \"id2\", \"name\": \"Justice League\", \"year\": 2017, \"year_facet\": \"2017\"},\n    {\"id\": \"id3\", \"name\": \"Wonder Woman 1984\", \"year\": 2020, \"year_facet\": \"2020\"},\n    {\"id\": \"id4\", \"name\": \"Death on the Nile\", \"year\": 2021, \"year_facet\": \"2021\"},\n]\n\n\nasync def main():\n    client = Client(\n        node_urls=[\"http://localhost:8108\"],\n        api_key=\"Rhsdhas2asasdasj2\",\n    )\n\n    r = await client.collections.create(\n        {\n            \"name\": \"movies\",\n            \"num_documents\": 0,\n            \"fields\": [\n                {\n                    \"name\": \"name\",\n                    \"type\": \"string\",\n                },\n                {\n                    \"name\": \"year\",\n                    \"type\": \"int32\",\n                },\n                {\n                    \"name\": \"year_facet\",\n                    \"type\": \"string\",\n                    \"facet\": True,\n                },\n            ],\n            \"default_sorting_field\": \"year\",\n        }\n    )\n\n    collection: Collection[Movie] = client.collections[\"movies\"]\n\n    r = await collection.documents.create_many(documents=MOVIES)\n    print(r)\n\n    search_r = await collection.documents.search(\n        {\n            \"q\": \"wonder woman 2021\",\n            \"query_by\": \"year_facet,name\",\n            \"query_by_weights\": \"1,1\",\n        }\n    )\n\n    print(search_r[\"hits\"])\n\n    # [\n    #     {\n    #         \"document\": {\n    #             \"id\": \"id3\",\n    #             \"name\": \"Wonder Woman 1984\",\n    #             \"year\": 2020,\n    #             \"year_facet\": \"2020\",\n    #         },\n    #         \"highlights\": [\n    #             {\n    #                 \"field\": \"year_facet\",\n    #                 \"matched_tokens\": [\"2020\"],\n    #                 \"snippet\": \"\u003cmark\u003e2020\u003c/mark\u003e\",\n    #             }\n    #         ],\n    #         \"text_match\": 1125899907169635,\n    #     },\n    #     {\n    #         \"document\": {\n    #             \"id\": \"id1\",\n    #             \"name\": \"Wonder Woman\",\n    #             \"year\": 2017,\n    #             \"year_facet\": \"2017\",\n    #         },\n    #         \"highlights\": [\n    #             {\n    #                 \"field\": \"year_facet\",\n    #                 \"matched_tokens\": [\"2017\"],\n    #                 \"snippet\": \"\u003cmark\u003e2017\u003c/mark\u003e\",\n    #             }\n    #         ],\n    #         \"text_match\": 1125899907169379,\n    #     },\n    #     {\n    #         \"document\": {\n    #             \"id\": \"id4\",\n    #             \"name\": \"Death on the Nile\",\n    #             \"year\": 2021,\n    #             \"year_facet\": \"2021\",\n    #         },\n    #         \"highlights\": [\n    #             {\n    #                 \"field\": \"year_facet\",\n    #                 \"matched_tokens\": [\"2021\"],\n    #                 \"snippet\": \"\u003cmark\u003e2021\u003c/mark\u003e\",\n    #             }\n    #         ],\n    #         \"text_match\": 562949953552128,\n    #     },\n    #     {\n    #         \"document\": {\n    #             \"id\": \"id2\",\n    #             \"name\": \"Justice League\",\n    #             \"year\": 2017,\n    #             \"year_facet\": \"2017\",\n    #         },\n    #         \"highlights\": [\n    #             {\n    #                 \"field\": \"year_facet\",\n    #                 \"matched_tokens\": [\"2017\"],\n    #                 \"snippet\": \"\u003cmark\u003e2017\u003c/mark\u003e\",\n    #             }\n    #         ],\n    #         \"text_match\": 562949953551616,\n    #     },\n    # ]\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n```\n\n## Contributing\n\n**Prerequisites:**\n - **poetry**\n - **nox**\n - **nox-poetry**\n\nInstall them on your system:\n```bash\npip install poetry nox nox-poetry\n```\n\nRun tests:\n```bash\nnox\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtud%2Faio_typesense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevtud%2Faio_typesense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtud%2Faio_typesense/lists"}