lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommaso Teofili <tommaso.teof...@gmail.com>
Subject Re: solrconfig.xml and xinclude
Date Thu, 22 Jul 2010 15:13:12 GMT
Just an update to say that the only way I figured out to include my 2
<field> tags was via the element() scheme :

* <xi:include href="solr/conf/**specific_**fields_1**.xml"
xpointer="element(/1/1)element(/1/2)" xmlns:xi="
http://www.w3.org/2001/XInclude">
     <xi:fallback>
           <xi:include href="solr/conf/**specific_**fields_**2.xml"
xpointer="element(/1/1)element(/1/2)"/>
     </xi:fallback>
   </xi:include>*

obviously this is not desirable and clean at all even if it can make the
trick if the number of fields is very small.
Any other ideas?
Cheers,
Tommaso

2010/7/22 Tommaso Teofili <tommaso.teofili@gmail.com>

> Hi,
> I am trying to do a similar thing within the schema.xml (using Solr 1.4.1),
> having a (super)schema that is common to 2 instances and specific fields I
> would like to include (with XInclude).
> Something like this:
>
> *<schema name="dummy" ... >
>    ...
>   <field name="A" type="string" indexed="true" stored="false"
> required="false" multiValued="true"/>
>   <field name="B" type="string" indexed="true" stored="false"
> required="false" multiValued="true"/>
>   <field name="C" type="string" indexed="true" stored="true"
> required="false"/>
>   <!-- xincluding here -->
>   <xi:include href="solr/conf/specific_**fields_1.xml" parse="xml">
>     <xi:fallback>
>            <xi:include href="solr/conf/specific_fields_2.**xml"
> parse="xml"/>
>      </xi:fallback>
>   </xi:include>
>   ...
> </schema>*
>
> and it works with the specific_fields_1.xml (or specific_fields_2.xml) like
> the following:
>
> *<field name="first_specific_field" type="string" indexed="true"
> stored="true" required="false"/>*
>
> but it stops working when I add more than one field in the included XML:
>
> *<fields>*
> *  <field name="first_specific_field" type="string" indexed="true"
> stored="true" required="false"/>*
>   *<field name="second_specific_field" type="string" indexed="true"
> stored="false" required="false"/>*
> *</fields>*
>
> and consequently modify the including element as following:
>
>  * <xi:include href="solr/conf/**specific_**fields_1**.xml" parse="xml"
> xpointer="/fields/field">
>      <xi:fallback>
>            <xi:include href="solr/conf/**specific_**fields_2**.xml"
> parse="xml" xpointer="/fields/field"/>
>      </xi:fallback>
>    </xi:include>*
>
> I tried to modify the *xpointer* attribute value to:
> *fields/field
> fields/*
> /fields/*
> element(/fields/field)
> element(/fields/*)
> element(fields/field)
> element(fields/*)
> *
> but I had no luck.
>
>
> Fiedzia, I think that xpointer="xpointer(something)" won't work as you can
> read in the last sentence of the page regarding SolrConfig.xml [1].
> I took a look to the Solr source code and I found a JUnit test for the
> XInclusion that tests the inclusion documented in the wiki [2][3].
> I also found an entry on Lucid Imagination website at [4] but couldn't fix
> my issue.
> Please, could someone help us regarding what is the right way to configure
> XInclude inside Solr?
> Thanks in advance for your time.
> Cheers,
> Tommaso
>
> [1] : http://wiki.apache.org/solr/SolrConfigXml
> [2] : http://wiki.apache.org/solr/SolrConfigXml#XInclude
> [3] :
> http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java
> [4] :
> http://www.lucidimagination.com/search/document/31a60b7ccad76de1/is_it_possible_to_use_xinclude_in_schema_xml
>
>
> 2010/7/21 fiedzia <fiedzia@gmail.com>
>
>
>> I am trying to export some config options common to all cores into single
>> file,
>> which would be included using xinclude. The only problem is how to include
>> childrens of given node.
>>
>>
>> common_solrconfig.xml looks like that:
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <config>
>>  <lib dir="/solr/lib" />
>> </config
>>
>>
>> solrconfig.xml looks like that:
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <config>
>> <!-- xinclude here -->
>> </config>
>>
>>
>> now all of the following attemps have failed:
>>
>> <xi:include href="/solr/common_solrconfig.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
>> <xi:include href="/solr/common_solrconfig.xml" xpointer="config/*"
>> xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
>> <xi:include href="/solr/common_solrconfig.xml"
>> xpointer="xpointer(config/*)"
>> xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
>>
>> <xi:include href="/solr/common_solrconfig.xml"
>> xpointer="element(config/*)"
>> xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/solrconfig-xml-and-xinclude-tp984058p984058.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>

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