lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Lynch <>
Subject Re: Duplicating a Solr Doc
Date Thu, 26 Aug 2010 04:29:30 GMT
It seems like this is a way to accomplish what I was looking for:
        CoreContainer coreContainer = new CoreContainer();
        File home = new
        File f = new File(home, "solr.xml");


        SolrCore core = coreContainer.getCore("newsblog");
        IndexSchema schema = core.getSchema();
        DocumentBuilder builder = new DocumentBuilder(schema);

        // get a Lucene Doc
        // Document d = ...

        SolrDocument solrDocument = new SolrDocument();

        builder.loadStoredFields(solrDocument, d);
        logger.debug("Loaded stored date: " +

However, one thing that scares me is the warning message I get from the
     [java] Aug 25, 2010 10:25:23 PM org.apache.solr.update.SolrIndexWriter
     [java] SEVERE: SolrIndexWriter was not closed prior to finalize(),
indicates a bug -- POSSIBLE RESOURCE LEAK!!!

I'm not sure what exactly triggers that but it's a result of the code I
posted above.

On Wed, Aug 25, 2010 at 10:49 PM, Max Lynch <> wrote:

> Right now I am doing some processing on my Solr index using Lucene Java.
> Basically, I loop through the index in Java and do some extra processing of
> each document (processing that is too intensive to do during indexing).
> However, when I try to update the document in solr with new fields (using
> SolrJ), the document either loses fields I don't explicitly set, or if I
> have Solr-specific fields such as a solr "date" field type, I am not able to
> copy the value as I can't read the value from Java.
> Is there a way to add a field to a solr document without having to
> re-create the document?  If not, how can I read the value of a Solr date in
> java?  Document.get("date_field") returns null even though the value shows
> up when I access it through solr.  If I could read this value I could just
> copy the fields from the Lucene Document to a SolrInputDocument.
> Thanks.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message