python client for sonic search backend
Project description
python-sonic-client
Python client for sonic search backend.
Install
pip install sonic-client
Examples
Ingest
from sonic import IngestClient
with IngestClient("127.0.0.1", 1491, "password") as ingestcl:
print(ingestcl.ping())
print(ingestcl.protocol)
print(ingestcl.bufsize)
ingestcl.push("wiki", "articles", "article-1", "for the love of god hell")
ingestcl.push("wiki", "articles", "article-2", "for the love of satan heaven")
ingestcl.push("wiki", "articles", "article-3", "for the love of lorde hello")
ingestcl.push("wiki", "articles", "article-4", "for the god of loaf helmet")
Search
from sonic import SearchClient
with SearchClient("127.0.0.1", 1491, "password") as querycl:
print(querycl.ping())
print(querycl.query("wiki", "articles", "for"))
print(querycl.query("wiki", "articles", "love"))
print(querycl.suggest("wiki", "articles", "hell"))
Control
from sonic import ControlClient
with ControlClient("127.0.0.1", 1491, "password") as controlcl:
print(controlcl.ping())
controlcl.trigger("consolidate")
API reference
API documentation can be found at docs/api and also Browsable
Difference from asonic
asonic uses asyncio and this client doesn't. It grew out of needing to use sonic within gevent context
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sonic-client-1.0.0.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonic-client-1.0.0.tar.gz.
File metadata
- Download URL: sonic-client-1.0.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe324c7354670488ed84847f6a6727d3cb5fb3675cb9b61396dcf5720e5aca66
|
|
| MD5 |
e43cf9ca951cf1fe874ec9d32b4165c2
|
|
| BLAKE2b-256 |
29475c356456e5dc3ba3f52d88a6b4d0661bdbe44a6a2340b3ca04005504c8ab
|
File details
Details for the file sonic_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sonic_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
291bf292861e97a2dd765ff0c8754ea9631383680d31a63ec3da6f5aa5f4beda
|
|
| MD5 |
926d391f7de080633a9288be31075682
|
|
| BLAKE2b-256 |
9d12e98f8533a5c5b28271be79b38e0648a69e4068907568a435276532bb2871
|