user404345
user404345

Reputation:

Build solrj query programmatically

I need to build solr queries programmatically based on user selections. e.g. if the user select a checkbox I add a clause, if they choose a dropdown I add another clause etc.

As I understand it solr simply accepts a string for the "q" param so I was thinking to use lucene's query builder to build the query then call toString(). It seems like a hack but I can't think of a better solution. Has anyone else done this before? Is there a better approach?

Upvotes: 0

Views: 360

Answers (1)

Qin Dong Liang
Qin Dong Liang

Reputation: 435

ok, you don't need use lucene to assemble some caluse , it also can use solrj to achieve to goal .
there are a simple codes: enter image description here


hope it can be help you !

Upvotes: 1

Related Questions