lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Woodward <>
Subject Re: Set up embedded Solr container and cores programmatically to read their configs from the classpath
Date Wed, 12 Feb 2014 17:44:01 GMT
Hi Robert,

I don't think this is possible at the moment, but I hope to get
in for Lucene/Solr 4.7, which should allow you to inject your own SolrResourceLoader implementation
for core creation (it sounds as though you want to wrap the core's loader in a ClasspathResourceLoader).
 You could try applying that patch to your setup and see if that helps you out.

Alan Woodward

On 11 Feb 2014, at 10:41, Robert Kr├╝ger wrote:

> Hi,
> I have an application with an embedded Solr instance (and I want to
> keep it embedded) and so far I have been setting up my Solr
> installation programmatically using folder paths to specify where the
> specific container or core configs are.
> I have used the CoreContainer methods createAndLoad and create using
> File arguments and this works fine. However, now I want to change this
> so that all configuration files are loaded from certain locations
> using the classloader but I have not been able to get this to work.
> E.g. I want to have my solr config located in the classpath at
> my/base/package/solr/conf
> and the core configs at
> my/base/package/solr/cores/core1/conf,
> my/base/package/solr/cores/core2/conf
> etc..
> Is this possible at all? Looking through the source code it seems that
> specifying classpath resources in such a qualified way is not
> supported but I may be wrong.
> I could get this to work for the container by supplying my own
> implementation of SolrResourceLoader that allows a base path to be
> specified for the resources to be loaded (I first thought that would
> happen already when specifying instanceDir accordingly but looking at
> the code it does not. for resources loaded through the classloader,
> instanceDir is not prepended). However then I am stuck with the
> loading of the cores' resources as the respective code (see
> org.apache.solr.core.CoreContainer#createFromLocal) instantiates a
> SolResourceLoader internally.
> Thanks for any help with this (be it a clarification that it is not possible).
> Robert

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