hi,

I am trying to use Solr data serialization module in a separate project,
such as serializing my own Java object to xml, python, json, or ruby
formats.

I have a look at org.apache.solr.request and figure out what I have to do to
use Solr's serialization in a standalone way:

-- Turn the Java Object to a org.apache.solr.util.NamedList object

-- Extends SolrQueryRequestBase to create an empty SolrQueryRequest object
class EmptySolrQueryRequest extends SolrQueryRequestBase {
   public EmptySolrQueryRequest() {
       super(null, null);
   }

   public IndexSchema getSchema() {
       return null;
   }

   public SolrIndexSearcher getSearcher() {
       return null;
   }

   public String getParam(String input) {
       if ("indent".equals(input))
           return "true";
       else
           return null;
   }
}

-- create a SolrQueryResponse object with my NamedList object and serialize
it



The whole process is pretty straightforward and doesn't need much code, as
Solr is clean in handling serialization, though I still need to poke inside
of Solr to write the code. So I wonder if I am doing the thing in a right
way? and is there a plan of pulling up that part of the code and make it
more straightforward for other applications?

thanks,
xiaoming

Reply via email to