Improving runtime search for Solr
To speed up the querying and rendering of results, it is important to optimize the runtime of Apache Solr. The optimization of Solr runtime can be achieved in various ways, which will be discussed shortly.
Pagination
A typical search screen provides results on a single page with pagination. Apache Solr provides support for pagination at the search level, thereby enabling search responses. When Solr fetches results for the queries passed by the user, Apache Solr allows users to limit the fetching of the result to a certain number by specifying the rows attribute in the search queries. For example, the following query will return 10 rows of results from 10 to 20:
q=Sudarshan&rows=10&start=10
The pagination parameters can also be specified in solrconfig.xml
as queryResultWindowSize
. By having a minimum page size, the response of a search over Apache Solr becomes fast, since it does not have to wait until all results are captured.