Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a SolrJ query builder?

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?

like image 608
user432024 Avatar asked Feb 22 '17 13:02

user432024


1 Answers

Unfortunately, in SolrJ there is no such thing as a Builder for the query that goes into the q-Parameter.

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.

like image 185
sven.windisch Avatar answered Oct 14 '22 16:10

sven.windisch