In the previous section, we saw how we can use the facet feature to group data together and seethe number of results in each genre. We can use the fq
parameter to further limit the search. Let's now see how we can use the fq
parameter to return only those songs whose genre is Pop
:
http://localhost:8983/solr/musicStore/select?q=*%3A*&wt=json&indent=true&fq=genre:Pop&fl=id,songName,genre
This URL will result in the following output:
{ "responseHeader":{ "status":0, "QTime":2 }, "response":{ "numFound":3, "start":0, "docs":[ { "id":"1001", "songName":"Don't Stop the Party", "genre":"Pop" }, { "id":"1002", "songName":"All I Want For Christmas Is You", "genre":"Pop" }, { "id":"1003", "songName":"A Thousand Years", "genre":"Pop" } ] } }
As we can...