{"id":28722293,"url":"https://github.com/youversion/aiosolr","last_synced_at":"2025-09-06T00:36:59.101Z","repository":{"id":35076930,"uuid":"204049058","full_name":"youversion/aiosolr","owner":"youversion","description":"Async Python client for Apache Solr","archived":false,"fork":false,"pushed_at":"2024-08-09T18:36:14.000Z","size":97,"stargazers_count":6,"open_issues_count":8,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-22T13:10:24.755Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/youversion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2019-08-23T18:18:10.000Z","updated_at":"2025-04-11T15:48:53.000Z","dependencies_parsed_at":"2024-04-18T17:38:48.716Z","dependency_job_id":"9717fe50-c11d-45d2-a987-ad38bcda5a4a","html_url":"https://github.com/youversion/aiosolr","commit_stats":{"total_commits":110,"total_committers":4,"mean_commits":27.5,"dds":"0.12727272727272732","last_synced_commit":"656beb600f5cab3967020db837d6c3bdbf093e6a"},"previous_names":["youversion/aiosolr","bbelyeu/aiosolr"],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/youversion/aiosolr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youversion%2Faiosolr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youversion%2Faiosolr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youversion%2Faiosolr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youversion%2Faiosolr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youversion","download_url":"https://codeload.github.com/youversion/aiosolr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youversion%2Faiosolr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273842801,"owners_count":25177920,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-06-15T08:07:37.732Z","updated_at":"2025-09-06T00:36:59.047Z","avatar_url":"https://github.com/youversion.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aiosolr\n\nAsyncIO Python client for Apache Solr\n\n## Requirements\n\nThis project requires Python 3.7+\n\n## Installation\n\nTo install with pip\n\n    pip install aiosolr\n\n## Usage\n\nThe connection to the Solr backend is defined during object initialization. The accepted kwargs to\ninit are `scheme`, `host`, `port`, and `collection`.\n\n\u003e `collection` may optionally be passed at query time\n\n```python\nimport aiosolr\n\nclient = aiosolr.Client(host=localhost, collection=\"example\", port=8983)\n```\n\nAlternatively you may instantiate via passing `connection_url` like:\n\n```python\nimport aiosolr\n\nclient = aiosolr.Client(connection_url=\"http://host:1234/path/to/solr/collection\")\n```\n\nOnce you have your `aiosolr.Client` instance, set up the session:\n\n```python\nawait client.setup()\n```\n\nThere are methods available for querying. You can use Solr's built-in get handler with the `get`\nmethod to retrieve a single document:\n\n```python\nawait client.get(document_id)\n```\n\nYou can use a pre-defined suggestions handler by using the `suggestions` method:\n\n```python\nawait client.suggestions(\"suggest_handler\", query=\"asdf\")\n```\n\nYou can also use the `suggestions` method to build your suggestions:\n\n```python\nawait client.suggestions(\"suggest_handler\", build=True)\n```\n\n\u003e `handler` is a required argument for suggestions unlike for get or query\n\nYou can use the `query` method to query your search handler. The default `handler` used is `select`.\nIf you would like spellcheck suggestion turned on, pass `spellcheck=True` (default is `False`).\n\n```python\nawait client.query(handler=\"my_handler\", query=\"asdf\", spellcheck=True)\n```\n\nIf `spellcheck` is `True` the query method returns a tuple with the first element being an array of\ndocuments and the 2nd element being an array of spellcheck suggestions. Otherwise, the query method\nreturns a simple array of documents.\n\nYou can use the `update` method to access Solr's built-in update handler like:\n\n```python\nawait client.update(my_data)\n```\n\nAt any point that you need to commit data to your collection you can use the `commit` method.\nArguments should be the `handler` (`update` by default) and `soft` as a boolean indicating whether\nit should be a hard or soft commit (defaults to `False`).\n\nThere is one more method you might want to use before querying Solr especially if the query is\ncoming from an untrusted end user. There is a `clean_query` method which can be used to strip out\nunwanted characters. Use it like:\n\n```python\ntrusted_query = aiosolr.clean_query(users_query)\n```\n\nOnce you are finished with the Solr instance, you should call the method `close` to cleanup sessions\nlike:\n\n```python\nawait client.close()\n```\n\n### Timeouts\n\nYou can initialize the client with `read_timeout` and `write_timeout` to limit how long to wait for\nrequests to complete. `read_timeout` applies to `get` and `query` whereas `write_timeout` applies to\n`update`:\n\n```python\nimport aiosolr\n\nclient = aiosolr.Client(connection_url=connection_url, read_timeout=5, write_timeout=30)\n```\n\nYou can override the timeouts for a specific request:\n\n```python\nawait client.get(document_id, read_timeout=1)  # I'm in a hurry\nawait client.update(doc, write_timeout=60)  # this is a large request so we expect it to take a long time\n```\n\n\u003e `aiosolr` uses\n\u003e [`asyncio.wait_for`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for)\n\u003e internally, so if a timeout occurs the exception raised is `asyncio.TimeoutError`.\n\n## Debugging\n\nTo get more information from the Client you can initialize with `debug=True`:\n\n```python\n    import aiosolr\n\n    client = aiosolr.Client(host=localhost, collection=\"example\", port=8983, debug=True)\n```\n\nThis sets the `aiosolr` logger to `DEBUG` level, and also sets the internally used HTTP session\n(provided by [aiohttp](https://docs.aiohttp.org/en/stable/logging.html)) to the `DEBUG` level. This\nmakes it easier to see the actual network requests going to Solr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouversion%2Faiosolr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouversion%2Faiosolr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouversion%2Faiosolr/lists"}