• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

solr-sql: 针对Solr的SQL查询引擎

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

solr-sql

开源软件地址:

https://gitee.com/bluejoe/solr-sql

开源软件介绍:

English Version: https://github.com/bluejoe2008/solr-sql/blob/master/README.md

solr-sql

solr-sql provides sql interfaces for solr cloud(http://lucene.apache.org/solr/), by which developers can operate on solr cloud via JDBC protocols.

On the same time, solr-sql is an Apache Calcite(see http://calcite.apache.org) adapter for solr.

solr-sql is written in Scala, which generates JVM byte codes like Java.

So, if you are a Java developer, do not hesitate to choose solr-sql, because it is easy to be referenced by Java code. Also the test cases are written in Java(see https://github.com/bluejoe2008/solr-sql/blob/master/src/java/test/SolrSqlQueryTest.java).

If you are interested in source codes, manybe you need install a ScalaIDE(http://scala-ide.org/), or scala plugins for eclipse.

solr-sql uses Maven to manage libary dependencies, it is a normal Maven project.

import solr-sql

use maven to import solr-sql:

<dependency>  <groupId>com.github.bluejoe2008</groupId>  <artifactId>solr-sql</artifactId>  <version>0.9</version></dependency>

JDBC client code

example code:

Properties info = new Properties();info.setProperty("lex", "JAVA");Connection connection = DriverManager.getConnection(		"jdbc:calcite:model=src/java/test/model.json", info);Statement statement = connection.createStatement();String sql = "select * from docs where not (age>35 and name='bluejoe')";ResultSet resultSet = statement.executeQuery(sql);

this illustrates how to connect to a solr 'database' in JDBC client manners, the schema of 'database' is defined in file 'src/java/test/model.json'.

run tests

https://github.com/bluejoe2008/solr-sql/blob/master/src/java/test/SolrSqlQueryTest.java shows how to connect to a JDBC source of solr.

https://github.com/bluejoe2008/solr-sql/blob/master/src/java/test/SqlTranslatorTest.java tests if the translation from SQL filters to Solr filters is right, like:

Assert.assertEquals("age_i:{20 TO *}",	trans("select * from docs where age>20"));

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap