How to make search request on Solr?

Solr is able to achieve fast search responses because, instead of searching the text directly, it searches an index instead.

You can make search request on Solr in following ways:

Search Request Query example:

Suppose, we need to get result of all books with title ‘Java’.

Then we would need to write query as shown below:


Here, in above example ‘fl’ is used specify which fields should be returned from documents matching the query.

We should see a result like the following:

"title_t":"The Java Book",
"title_t":"Java Black Ook",

Solr Search Request in JSON:

If you prefer using JSON to search the index, you can use the JSON Request API:

$ curl http://localhost:8983/solr/demo/query -d '
  "query" : "title_t:java",
  "fields" : ["title_t", "author_s"]
Sorting and Paging Search Results:
By default, Solr  will return the top 10 documents ordered by highest score (relevance) first. We can change this count as shown below:
$ curl http://localhost:8983/solr/demo/query -d ‘
fq=publisher_s:Abc&  // filter query based on publisher
sort=pubyear_i desc& //sorts the “pubyear_i” field in descending
To manage search result count in above query we use row=3.
And we get the response as requested:“response”:{“numFound”:5,”start”:0,”docs”:[

ProsperaSoft offers Solr development solutions. You can email at to get in touch with ProsperaSoft Solr  experts and consultants.



Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>