Developing a Request Handler For Solr

Thanks to Andrew Janowczyk of Searchbox.com for this post.

In our previous blog post, Developing a Solr plugin we discussed the different types of plugins available for Solr. Additionally, we provided a slideshare and sample source code for a Search Component. This time around we provide the slide share and source code for making a Solr Request Handler.

Request handlers are used to provide a REST endpoint from the Solr instance to get some work done. An example would be: http://localhost:8982/collection1/detectLanguage?q=”text to use to detect language”. Notice that the difference here is that we can provide plain text as the query and have it process the text directly and produce an XML result similar to the following:

[code language=”XML”]
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<lst name="results">
<str name="language">en</str>
</lst>
</response>
[/code]

These types of plugins are very useful for not only processing mainly text, but for working with the underlying repository. You will also have access to the information contained in the documents, so for example you could use a requestHandler to count how many times the word “searchbox” appears in all of the indexed documents, since the result is not on a per document bases but instead representative of the entire repository, it makes more sense to use a request handler.

[slideshare id=21179289&doc=developasolrrequesthandlerplugin-130514170308-phpapp01]

You Might Also Like

How Lenovo made search a strategic growth driver in the AI era

Discover how Lenovo turned search into a strategic growth driver with Lucidworks,...

Read More

The State of Generative AI 2025: 3 questions to understand your agentic AI readiness

How prepared are businesses for agentic AI? Lucidworks data gives us the...

Read More

Announcing our 2025 Superstars of Search Award winners: Mouser, TE, and Coppel

Celebrating 3 incredible Lucidworks clients who transformed their search experiences and drove...

Read More

Quick Links