You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Robert Stewart <bs...@gmail.com> on 2012/01/24 18:33:39 UTC

using pre-core properties in dih config

I have a multi-core setup, and for each core I have a shared
data-config.xml which specifies a SQL query for data import.  What I
want to do is have the same data-config.xml file shared between my
cores (linked to same physical file). I'd like to specify core
properties in solr.xml such that each core loads a different set of
data from SQL.  So my query might look like this:

query="select * from index_values where mod(index_id,${NUM_CORES})=${CORE_ID}"

So I want to have NUM_CORES and CORE_ID specified as properties in
solr.xml, something like:

<solr ...>
  <cores ..>
     <property name="NUM_CORES" value="3"/>
     <core name="index0" ...>
        <property name="CORE_ID" value="0"/>
     </core>
     <core name="index1" ...>
        <property name="CORE_ID" value="1"/>
     </core>
     <core name="index2" ...>
        <property name="CORE_ID" value="2"/>
     </core>
  </cores>

</solr>

So my question is, is this possible, and if so what is exact syntax to
make it work?

Thanks,
Bob

Re: using pre-core properties in dih config

Posted by Esteban Donato <es...@gmail.com>.
they way you described it is how DIH works with variable replacement.
Alternatively, you can define the per-core properties in
SOLR_HOME/<core-name>/conf/solrcore.properties file as a list of
key=value pairs.  For the global variable, NUM_CORES, you can define
it as a JVM system property, like -DNUM_CORES=3

On Tue, Jan 24, 2012 at 2:33 PM, Robert Stewart <bs...@gmail.com> wrote:
> I have a multi-core setup, and for each core I have a shared
> data-config.xml which specifies a SQL query for data import.  What I
> want to do is have the same data-config.xml file shared between my
> cores (linked to same physical file). I'd like to specify core
> properties in solr.xml such that each core loads a different set of
> data from SQL.  So my query might look like this:
>
> query="select * from index_values where mod(index_id,${NUM_CORES})=${CORE_ID}"
>
> So I want to have NUM_CORES and CORE_ID specified as properties in
> solr.xml, something like:
>
> <solr ...>
>  <cores ..>
>     <property name="NUM_CORES" value="3"/>
>     <core name="index0" ...>
>        <property name="CORE_ID" value="0"/>
>     </core>
>     <core name="index1" ...>
>        <property name="CORE_ID" value="1"/>
>     </core>
>     <core name="index2" ...>
>        <property name="CORE_ID" value="2"/>
>     </core>
>  </cores>
>
> </solr>
>
> So my question is, is this possible, and if so what is exact syntax to
> make it work?
>
> Thanks,
> Bob