{"id":14981082,"url":"https://github.com/smartmonkey-git/py-toshi-client","last_synced_at":"2025-10-29T04:31:37.656Z","repository":{"id":246760201,"uuid":"810778068","full_name":"SmartMonkey-git/py-toshi-client","owner":"SmartMonkey-git","description":"Python Client for the Full-Text Search Engine Toshi","archived":false,"fork":false,"pushed_at":"2024-07-02T08:20:14.000Z","size":88,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T22:02:18.148Z","etag":null,"topics":["client","elasticsearch","python","search-engine"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/toshi-client/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartMonkey-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-05T10:39:48.000Z","updated_at":"2024-07-18T00:52:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"f99d40cd-3d31-4f80-aef0-1ca407825ee3","html_url":"https://github.com/SmartMonkey-git/py-toshi-client","commit_stats":{"total_commits":78,"total_committers":2,"mean_commits":39.0,"dds":"0.038461538461538436","last_synced_commit":"f157549d49e55f3197ec240026d216bafcd6e8e7"},"previous_names":["smartmonkey-git/py-toshi-client"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartMonkey-git%2Fpy-toshi-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartMonkey-git%2Fpy-toshi-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartMonkey-git%2Fpy-toshi-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartMonkey-git%2Fpy-toshi-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartMonkey-git","download_url":"https://codeload.github.com/SmartMonkey-git/py-toshi-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238768422,"owners_count":19527197,"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":["client","elasticsearch","python","search-engine"],"created_at":"2024-09-24T14:02:53.632Z","updated_at":"2025-10-29T04:31:37.282Z","avatar_url":"https://github.com/SmartMonkey-git.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toshi Python Client\nThis repository is a client for the [Full-Text Search Engine Toshi](https://github.com/toshi-search/Toshi). It allows you to use all features implemented in the Toshi engine.\n\n### How to install\nThe client is available as a package on [Pypi](https://pypi.org/project/toshi-client/) and can be installed via:\n```shell\npip install toshi-client\n```\n\n### Examples\nFor a full set of examples check out the [integration tests](https://github.com/SmartMonkey-git/py-toshi-client/blob/main/tests/test_integration_sync.py).\n\nHere is a basic example:\n\n1. Create an index and submit it\n\n```python\nfrom toshi_client.client import ToshiClient\nfrom toshi_client.index.index_builder import IndexBuilder\nfrom toshi_client.index.field_options import TextOptionIndexing\n\nbuilder = IndexBuilder()\n\nbuilder.add_text_field(name=\"lyrics\", stored=True, indexing=TextOptionIndexing())\nbuilder.add_i64_field(name=\"year\", stored=True, indexed=True)\nbuilder.add_u64_field(name=\"idx\", stored=True, indexed=True)\nbuilder.add_text_field(name=\"artist\", stored=True, indexing=TextOptionIndexing())\nbuilder.add_text_field(name=\"genre\", stored=True, indexing=TextOptionIndexing())\nbuilder.add_text_field(name=\"song\", stored=True, indexing=TextOptionIndexing())\nbuilder.add_facet_field(name=\"test_facet\", stored=True)\n\nindex = builder.build(\"lyrics\")\n    \nclient = ToshiClient(\"http://localhost:8080\")\nclient.create_index(index=index)\n```\n\n2. Create a document class according to the just created index\n\n```python\nfrom toshi_client.models.document import Document\n\nclass Lyrics(Document):\n    @staticmethod\n    def index_name() -\u003e str:\n        return \"lyrics\"\n\n    def __init__(\n        self,\n        lyrics: str,\n        year: int,\n        idx: int,\n        artist: str,\n        genre: str,\n        song: str,\n    ):\n        self.lyrics = lyrics\n        self.year = year\n        self.idx = idx\n        self.artist = artist\n        self.genre = genre\n        self.song = song\n```\n3. Submit a document to Toshi\n\n```python\ndoc = Lyrics(\n    lyrics=\"Gold on the ceiling, I ain't blind, just a matter of time\",\n    year=2011,\n    idx=2,\n    artist=\"The Black Keys\",\n    genre=\"Rock\",\n    song=\"Gold on the Ceiling\",\n)\nclient.add_document(document=doc)\n```\n4. Use a query of your choice to retrieve it\n\n```python\nfrom toshi_client.query.term_query import TermQuery\n\nquery = TermQuery(term=\"ceiling\", field_name=\"lyrics\")\ndocuments = client.search(query, Lyrics)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartmonkey-git%2Fpy-toshi-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartmonkey-git%2Fpy-toshi-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartmonkey-git%2Fpy-toshi-client/lists"}