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 "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de> on 2009/03/19 11:11:04 UTC

Combination of solr.xml and solrconfig.xml

Hi,

I have a little question concerning the combination of solr.xml and 
solrconfig.xml !
I am running a multicore configuration for doing multiple language index 
files ...

my structure is like

\solr (solr.xml)
\solr\core_de (solrconfig.xml for german profile)
\solr\core_uk (solrconfig.xml for english profile)

My problem is that there is many many redundant code in the two 
solrconfig.xml file and I wonder
if I can move this code to solr.xml and only leave the core specific 
lines in the solrconfig.xml ?

Is there any chance to combine solrconfig.xml files ? Or any other 
suggestions ?

Greets,

Ralf

Re: Combination of solr.xml and solrconfig.xml

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Mar 24, 2009 at 4:16 PM, Kraus, Ralf | pixelhouse GmbH <
rk@pixelhouse.de> wrote:

> Hi,
>
>> question ;-)
>>
>> <!DOCTYPE config SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [
>>
>>   <!ENTITY default_solrconfig SYSTEM
>> "/var/lib/tomcat5.5/webapps/solr/default_solrconfig.xml">
>>
>> ]>
>>
>> Is there a chance to set the "home directory" using a variable ? For
>> example an unix enviroment variable ?
>>
>> Greets -Ralf-
>>
> No chance ?
>

One can use system variables in solrconfig.xml through the ${var-name}
syntax but that is expanded only for DOM elements. It may not work for the
entity includes though I haven't tried.

-- 
Regards,
Shalin Shekhar Mangar.

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Hi,
> question ;-)
>
> <!DOCTYPE config SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [
>
>    <!ENTITY default_solrconfig SYSTEM 
> "/var/lib/tomcat5.5/webapps/solr/default_solrconfig.xml">
>
> ]>
>
> Is there a chance to set the "home directory" using a variable ? For 
> example an unix enviroment variable ?
>
> Greets -Ralf-
No chance ?

Greets -Ralf-

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Erik Hatcher schrieb:
> Unfortunately Solr doesn't offer that kind of reusability (yet).
>
> But you could just go old school and use XML entity includes to pull 
> in a fragment of a file, and externalize the common pieces that way. 
> Not as pretty, but oughta work.
one last little question ;-)

<!DOCTYPE config SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [

    <!ENTITY default_solrconfig SYSTEM 
"/var/lib/tomcat5.5/webapps/solr/default_solrconfig.xml">

]>

Is there a chance to set the "home directory" using a variable ? For 
example an unix enviroment variable ?

Greets -Ralf-

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Erik Hatcher schrieb:
> Unfortunately Solr doesn't offer that kind of reusability (yet).
>
> But you could just go old school and use XML entity includes to pull 
> in a fragment of a file, and externalize the common pieces that way. 
> Not as pretty, but oughta work.

thx a lot ! This sounds perfect... (yet)

Greets -Ralf-


Re: Combination of solr.xml and solrconfig.xml

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Unfortunately Solr doesn't offer that kind of reusability (yet).

But you could just go old school and use XML entity includes to pull  
in a fragment of a file, and externalize the common pieces that way.  
Not as pretty, but oughta work.

	Erik


On Mar 19, 2009, at 10:05 AM, Giovanni De Stefano wrote:

> Hello Ralf,
>
> what you can do is the following:
>
> 1) you have the following in all your solrconfig.xml files:
>
> <admin>
>  <defaultQuery>Type your query and press Search!</defaultQuery>
> </admin>
>
> 2) you want to move this into the single solr.xml. To achieve this  
> you have
> to do the following:
>
> 2.1) in solr.xml:
>
> <solr ...>
>  <cores ..>
>    <core ..>
>  </cores>
>
> *<property name="whateverName" value="Type your query and press  
> Search!" />*
>
> 2.2) in ALL solrconfig.xml files:
>
> <config>
> ...
>  <admin>
>    <defaultQuery>*${whateverName}*</defaultQuery>
>  </admin>
> </config>
>
> You cannot put in solr.xml pieces of XML; what you can put there are  
> pure
> properties that are tokenized in all solrconfig.xml.
>
> I hope it helps.
>
> Giovanni
>
> On 3/19/09, Kraus, Ralf | pixelhouse GmbH <rk...@pixelhouse.de> wrote:
>>
>> Giovanni De Stefano schrieb:
>>
>>> On the other hand, if your files have 199 lines in *common*, then  
>>> yes, you
>>> could/should move those 199 common lines in solr.xml.
>>>
>>>
>> YES ! Thats my case
>>
>> But how could I transfer this lines (solrconfig.xml)
>>
>> <config>
>> <dataDir>/www/solr/xxxx/xxxxxx</dataDir>
>> <updateHandler class="solr.DirectUpdateHandler2" />
>>
>> <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</ 
>> abortOnConfigurationError>
>>
>> <indexDefaults>
>> <useCompoundFile>false</useCompoundFile>
>> <mergeFactor>2</mergeFactor>
>> <ramBufferSizeMB>32</ramBufferSizeMB>
>> <maxMergeDocs>2147483647</maxMergeDocs>
>> <maxFieldLength>10000</maxFieldLength>
>> <writeLockTimeout>1000</writeLockTimeout>
>> <commitLockTimeout>10000</commitLockTimeout>
>> <lockType>single</lockType>
>> </indexDefaults>
>>
>> <mainIndex>
>> <useCompoundFile>false</useCompoundFile>
>> <mergeFactor>2</mergeFactor>
>> <ramBufferSizeMB>32</ramBufferSizeMB>
>> <maxMergeDocs>2147483647</maxMergeDocs>
>> <maxFieldLength>10000</maxFieldLength>
>> <unlockOnStartup>false</unlockOnStartup>
>> </mainIndex>
>>
>> etc.
>>
>> to my solr.xml
>>
>> ???
>>
>> Greets -Ralf-
>>


Re: Combination of solr.xml and solrconfig.xml

Posted by Giovanni De Stefano <gi...@gmail.com>.
Hello Ralf,

what you can do is the following:

1) you have the following in all your solrconfig.xml files:

<admin>
  <defaultQuery>Type your query and press Search!</defaultQuery>
</admin>

2) you want to move this into the single solr.xml. To achieve this you have
to do the following:

2.1) in solr.xml:

<solr ...>
  <cores ..>
    <core ..>
  </cores>

*<property name="whateverName" value="Type your query and press Search!" />*

2.2) in ALL solrconfig.xml files:

<config>
...
  <admin>
    <defaultQuery>*${whateverName}*</defaultQuery>
  </admin>
</config>

You cannot put in solr.xml pieces of XML; what you can put there are pure
properties that are tokenized in all solrconfig.xml.

I hope it helps.

Giovanni

On 3/19/09, Kraus, Ralf | pixelhouse GmbH <rk...@pixelhouse.de> wrote:
>
> Giovanni De Stefano schrieb:
>
>> On the other hand, if your files have 199 lines in *common*, then yes, you
>> could/should move those 199 common lines in solr.xml.
>>
>>
> YES ! Thats my case
>
> But how could I transfer this lines (solrconfig.xml)
>
> <config>
>  <dataDir>/www/solr/xxxx/xxxxxx</dataDir>
>  <updateHandler class="solr.DirectUpdateHandler2" />
>
>  <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
>
>  <indexDefaults>
>  <useCompoundFile>false</useCompoundFile>
>  <mergeFactor>2</mergeFactor>
>  <ramBufferSizeMB>32</ramBufferSizeMB>
>  <maxMergeDocs>2147483647</maxMergeDocs>
>  <maxFieldLength>10000</maxFieldLength>
>  <writeLockTimeout>1000</writeLockTimeout>
>  <commitLockTimeout>10000</commitLockTimeout>
>  <lockType>single</lockType>
>  </indexDefaults>
>
>  <mainIndex>
>  <useCompoundFile>false</useCompoundFile>
>  <mergeFactor>2</mergeFactor>
>  <ramBufferSizeMB>32</ramBufferSizeMB>
>  <maxMergeDocs>2147483647</maxMergeDocs>
>  <maxFieldLength>10000</maxFieldLength>
>  <unlockOnStartup>false</unlockOnStartup>
>  </mainIndex>
>
> etc.
>
> to my solr.xml
>
> ???
>
> Greets -Ralf-
>

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Giovanni De Stefano schrieb:
> On the other hand, if your files have 199 lines in *common*, then yes, you
> could/should move those 199 common lines in solr.xml.
>   
YES ! Thats my case

But how could I transfer this lines (solrconfig.xml)

<config>
  <dataDir>/www/solr/xxxx/xxxxxx</dataDir>
  <updateHandler class="solr.DirectUpdateHandler2" />
  
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
 
  <indexDefaults>
   <useCompoundFile>false</useCompoundFile>
   <mergeFactor>2</mergeFactor>
   <ramBufferSizeMB>32</ramBufferSizeMB>
   <maxMergeDocs>2147483647</maxMergeDocs>
   <maxFieldLength>10000</maxFieldLength>
   <writeLockTimeout>1000</writeLockTimeout>
   <commitLockTimeout>10000</commitLockTimeout>
   <lockType>single</lockType>
  </indexDefaults>

  <mainIndex>
   <useCompoundFile>false</useCompoundFile>
   <mergeFactor>2</mergeFactor>
   <ramBufferSizeMB>32</ramBufferSizeMB>
   <maxMergeDocs>2147483647</maxMergeDocs>
   <maxFieldLength>10000</maxFieldLength>
   <unlockOnStartup>false</unlockOnStartup>
  </mainIndex>

etc.

to my solr.xml

???

Greets -Ralf-

Re: Combination of solr.xml and solrconfig.xml

Posted by Giovanni De Stefano <gi...@gmail.com>.
Hello Ralf,

I am confused now.

Perhaps you can post a short extract of your files and show me what you are
trying to achieve?

If your files *differs* for 199 lines...well...they should stay the way they
are!

On the other hand, if your files have 199 lines in *common*, then yes, you
could/should move those 199 common lines in solr.xml.

Cheers,
Giovanni


On 3/19/09, Kraus, Ralf | pixelhouse GmbH <rk...@pixelhouse.de> wrote:
>
> Giovanni De Stefano schrieb:
>
>> Hello Ralf,
>>
>> I believe you want to do something like:
>>
>> <solr persistent="true" sharedLib="lib">
>>  <cores adminPath="/admin/cores">
>>  <core name="core0" instanceDir="core0">
>>    <property name="dataDir" value="/data/core0" />
>>  </core>
>>  <core name="core1" instanceDir="core1" />
>>  </cores>
>> </solr>
>>
>>
> Okay I will try to explain it better :-)
>
> - my two solrconfig.xml files are around 200 lines long
> - ONLY one line is the difference between this files :
> <dataDir>/www/solr/xxxx/xxxxx</dataDir>
> - I want to transfer this 199 other lines to my solr.xml so I don´t have
> this lines redundant.
>
> Greets -Ralf-
>
>

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Giovanni De Stefano schrieb:
> Hello Ralf,
>
> I believe you want to do something like:
>
> <solr persistent="true" sharedLib="lib">
>   <cores adminPath="/admin/cores">
>   <core name="core0" instanceDir="core0">
>     <property name="dataDir" value="/data/core0" />
>   </core>
>   <core name="core1" instanceDir="core1" />
>  </cores>
> </solr>
>   
Okay I will try to explain it better :-)

- my two solrconfig.xml files are around 200 lines long
- ONLY one line is the difference between this files : 
<dataDir>/www/solr/xxxx/xxxxx</dataDir>
- I want to transfer this 199 other lines to my solr.xml so I don´t have 
this lines redundant.

Greets -Ralf-


Re: Combination of solr.xml and solrconfig.xml

Posted by Giovanni De Stefano <gi...@gmail.com>.
Hello Ralf,

I believe you want to do something like:

<solr persistent="true" sharedLib="lib">
  <cores adminPath="/admin/cores">
  <core name="core0" instanceDir="core0">
    <property name="dataDir" value="/data/core0" />
  </core>
  <core name="core1" instanceDir="core1" />
 </cores>
</solr>

Cheers,
Giovanni

On 3/19/09, Kraus, Ralf | pixelhouse GmbH <rk...@pixelhouse.de> wrote:
>
> Giovanni De Stefano schrieb:
>
>> Guten Tag Ralf,
>>
>> try to look here: http://wiki.apache.org/solr/CoreAdmin
>>
>> It says: "You can also specify properties in solr.xml which can be used in
>> the solrconfig.xml and schema.xml files." I believe this might help.
>>
>>
> thx !!
>
> I tried this :
>
> (My solr.xml :)
>
> <solr persistent="true" sharedLib="lib">
>  <config>
>   <updateHandler class="solr.DirectUpdateHandler2" />
>   etc. . . . .
>  </config>
>
>  <cores adminPath="/admin/cores">
>
>   <core name="core_uk" instanceDir="core_uk">
>
>     <config>
>           <dataDir>/xxxx/xxxxx/xxxxx</dataDir>
>
>     </config>
>
>   </core>
>
>  </cores>
>
> </solr>
>
> Doesnt seem to work :-(
>
> Greets -Ralf-
>

Re: Combination of solr.xml and solrconfig.xml

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Giovanni De Stefano schrieb:
> Guten Tag Ralf,
>
> try to look here: http://wiki.apache.org/solr/CoreAdmin
>
> It says: "You can also specify properties in solr.xml which can be used in
> the solrconfig.xml and schema.xml files." I believe this might help.
>   
thx !!

I tried this :

(My solr.xml :)

<solr persistent="true" sharedLib="lib">
  <config>
    <updateHandler class="solr.DirectUpdateHandler2" />
    etc. . . . .
  </config>

  <cores adminPath="/admin/cores">
 
    <core name="core_uk" instanceDir="core_uk">

      <config>
     
        <dataDir>/xxxx/xxxxx/xxxxx</dataDir>

      </config>

    </core>

  </cores>

</solr>

Doesnt seem to work :-(

Greets -Ralf-

Re: Combination of solr.xml and solrconfig.xml

Posted by Giovanni De Stefano <gi...@gmail.com>.
Guten Tag Ralf,

try to look here: http://wiki.apache.org/solr/CoreAdmin

It says: "You can also specify properties in solr.xml which can be used in
the solrconfig.xml and schema.xml files." I believe this might help.

Cheers,
Giovanni


On 3/19/09, Kraus, Ralf | pixelhouse GmbH <rk...@pixelhouse.de> wrote:
>
> Hi,
>
> I have a little question concerning the combination of solr.xml and
> solrconfig.xml !
> I am running a multicore configuration for doing multiple language index
> files ...
>
> my structure is like
>
> \solr (solr.xml)
> \solr\core_de (solrconfig.xml for german profile)
> \solr\core_uk (solrconfig.xml for english profile)
>
> My problem is that there is many many redundant code in the two
> solrconfig.xml file and I wonder
> if I can move this code to solr.xml and only leave the core specific lines
> in the solrconfig.xml ?
>
> Is there any chance to combine solrconfig.xml files ? Or any other
> suggestions ?
>
> Greets,
>
> Ralf
>