有SolrJ查询生成器吗? [英] Is there a SolrJ query builder?
问题描述
使用solr 5.2.0想知道是否有类似于Elasticsearch查询构建器API的查询构建器API/Jar/Ckient,还是我们必须大胆地做String Kungfu才能在Solr中构建查询?
Using solr 5.2.0 was wondering is there a query builder API/Jar/Ckient similar to Elasticsearch query builder API or do we have to bassically do String Kungfu to build queries in Solr?
推荐答案
不幸的是,在SolrJ中,没有诸如查询的生成器之类的东西进入q
-Parameter.
Unfortunately, in SolrJ there is no such thing as a Builder for the query that goes into the q
-Parameter.
但是:由于Solr已经在Lucene上运行,因此我们也可以使用Lucene PhraseQuery )的toString()
方法为您提供查询字符串,否则您将不得不手工进行组装.
BUT: As Solr already operates on Lucene, we can as well use the Lucene QueryBuilder. The resulting Query objects (e.g. PhraseQuery) have a toString()
method that provides you with the query string you would otherwise have to assemble by hand.
这篇关于有SolrJ查询生成器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!