Client API overview

Solr comes with a bunch of REST APIs, which exposes its features such as query, index, delete, commit, and optimize; it also allows a web application to connect with Solr and perform any operation by calling these APIs. Solr has taken care of these REST APIs such that any web application developed in any programming language can connect to them. A REST API is developed based on the HTTP protocol; so a web application developed in any programming language, such as Java, .NET, Python, and Ruby, can easily connect to and call this API to perform various Solr operations. Using this API, a web application asks Solr to perform some operations, such as querying and indexing. Solr performs those operations and provides a response to the application. Solr also supports various response formats based on programming languages such as Java, JavaScript/JSON, Python, Ruby, PHP, and many more (we have seen this in Chapter 6, Advanced Queries – Part I). So it becomes very easy for any programming languages to deal with Solr and to parse a response in expected format. Now Solr is the first choice for web applications developed in any language.

Queries are executed by creating a URL that contains all the query parameters. Solr examines the request URL, performs the query, and returns the response. The default response format is JSON, but we can configure the response format by the wt parameter. The other operations are similar, although in certain cases the HTTP request is a POST operation and contains information beyond whatever is included in the request URL. For example, an index operation may contain a document in the body of the request.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.156.204