0
votes

I have a module which contains 4 section list view as Id, Name, Dept, and Age. In my UI if I select multiple names from "Name" Section and I also selecting Multiple dept values from "Dept" section all this field should generate a query to hit Solr API and returns response. I tried some example not working

here my sample Query which I have tried so far :

http://localhost:8983/solr/leadsight/select?indent=on&q=Arjun&fq=Name:Arjun&facet=true&facet.field=Name&facet.sort=count&facet.missing=true&rows=100000&wt=json&indent=true

the above query to find only one value search but I want multiple values and also different Field value data should pass to the Solr query.

1

1 Answers

0
votes

As per your coding requirements:

1.Its always preferable to select the values as Int, than string from the dropdowns and pass the same to query(in Solr or any database), make sure to have array format in the name in the HTML, which selects the multiple selected values from the dropdowns.

<select name="some_name[]">
<option value="0">select all</option>
<option value="1">Arjun</option>
<option value="2">Ajay</option>
<option value="3">Anil</option>
</select>

2.In select option consider option value to be 0, for select all, and if the option select all dept is selected from the UI, just don't add the dept in the where condition (as the query is to select for all the depts.)

<option value="0">select all dept</option>