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 Michael <so...@gmail.com> on 2009/11/09 20:57:28 UTC

default a parameter to a core's name

Hi,

Is there a way for me to set up my solr.xml so that slave cores
replicate from the master's identically-named cores by default, but I
can override the core to replicate from if I wish? Something like
this, where core1 and core2 on the slave default to replicating from
foo/solr/core1 and foo/solr/core2, but core3 replicates from
foo/solr/core15.

# slave's solrconfig.xml
<!-- in slave replication section -->
<str name="masterUrl">http://foo/solr/${replicateCore}/replication</str>

# slave's solr.xml
<solr>
  <property name="replicateCore" value="${solr.core.name}" />
  <cores>
    <core name="core1" /> <!-- defaults to replicating from foo/solr/core1 -->
    <core name="core2" /> <!-- defaults to replicating from foo/solr/core2 -->
    <core name="core3">
      <!-- replicates from foo/solr/core15 -->
      <property name="replicateCore" value="core15" />
    </core>
  </cores>
</solr>

This doesn't quite work because solr.core.name is not a valid variable
outside the <cores> section.  I also tried putting
"${replicateCore:${solr.core.name}}" in the solrconfig.xml, but the
default in that case is literally "${solr.core.name}" -- the variable
expansion isn't recursive.

Thanks in advance for any pointers.

Michael