Hi Juha,

If it's just a matter of format, have you considered adding another layer 
between Solr where you've got a class that just takes in your queries in the 
proprietary format and then converts them to what Solr needs? Similarly, if you 
need your results in a format, just convert them again? I would imagine that'd 
be a lot simpler than subclassing Solr classes.

Swati

-----Original Message-----
From: Juha Haaga [mailto:juha.ha...@codenomicon.com] 
Sent: Thursday, June 20, 2013 9:33 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