- Notifications
You must be signed in to change notification settings - Fork8
sonic search backend client in python
License
NotificationsYou must be signed in to change notification settings
xmonader/python-sonic-client
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Python client forsonic search backend.
pip install sonic-client
fromsonicimportIngestClientwithIngestClient("127.0.0.1",1491,"password")asingestcl: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")
fromsonicimportSearchClientwithSearchClient("127.0.0.1",1491,"password")asquerycl:print(querycl.ping())print(querycl.query("wiki","articles","for"))print(querycl.query("wiki","articles","love"))print(querycl.suggest("wiki","articles","hell"))
fromsonicimportControlClientwithControlClient("127.0.0.1",1491,"password")ascontrolcl:print(controlcl.ping())controlcl.trigger("consolidate")
API documentation can be found atdocs/api and alsoBrowsable
asonic uses asyncio and this client doesn't. It grew out of needing to use sonic within gevent context