Sonic Search后端的Python客户端

sonic-client的Python项目详细描述


python sonic客户端

用于sonic搜索后端的python客户端。

安装

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参考

api文档可以在docs/apiBrowsable

与asonic的区别

asonic使用asyncio,而这个客户机不使用asyncio。它不再需要在gevent上下文中使用sonic

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
字典java cassandra对象映射注释   java定制Solr TokenFilter lemmatizer   字符串从Java文件中读取windows文件名   java如何在Windows上设置StanfordCorenlp服务器以返回文本   java axis2“意外的子元素值”   java使用POI HSSF获取错误   多线程Java等待计时器线程完成   java ForkJoinPool BuffereImage处理风格   从java代码运行Python脚本   java将字节[]转换为短[],使每个短元素包含13位数据   java如何为swing jframe应用程序将代码划分为类   java使用okhttp更改baseurl   java AlertDialog。建设者setView导致堆栈溢出错误   java如何在特定的radius 安卓 studio中接收地址列表?