First, my standard admonition: DON'T DO IT!!! Try harder to use the features Solr provides before trying to shoehorn even more code into Solr.

And... think again about whether this code needs to be inside of Solr as opposed to simply doing multiple requests in a clean, RESTful application layer that is completely under your own control.

Those disclaimers out of the way...

Start by studying any of the existing query parser plugins - AND its unit tests.

Ditto with search components.

Keep studying until you have specific questions.

-- Jack Krupansky

-----Original Message----- From: Juha Haaga
Sent: Thursday, June 20, 2013 9:32 AM
To: solr-user@lucene.apache.org
Subject: Steps for creating a custom query parser and search component

Hello list followers,

I need to write a custom Solr query parser and a search component. The requirements for the component are that the raw query that may need to be split into separate Solr queries is in a proprietary format encoded in JSON, and the output is also going to be in a similar proprietary JSON format. I would like some advice on how to get started.

Which base classes should I start to work with? I have been looking at the plugin classes and my initial thoughts are along the lines of following workflow:

1. Subclass (QParser?) and write a new parser method that knows how to deal with the input format. 2. Subclass (SolrQueryRequestBase?) or use LocalSolrQueryRequest like in the TestHarness.makeRequest() and use it to execute the required queries.
3. Compile the aggregate results as specified in the query.
4. Use some existing component (?) for returning the results to the user.
5. Put these components in steps 1-4 together into (?) so that it can be added to solrconfig.xml as a custom query parser accessible at http://solr/core/customparser

Is my approach reasonable, or am I overlooking some canonical way of achieving what I need to do? What and where do I need to look into to replace the question marks in my plan with knowledge? :)

-- Juha

Reply via email to