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 Peter Wolanin <pe...@acquia.com> on 2009/11/28 19:40:33 UTC

is it possible to use Xinclude in schema.xml?

I'm trying to determine if it's possible to use Xinclude to (for
example) have a base schema file and then substitute various pieces.

It seems that the schema fieldTypes throw exceptions if there is an
unexpected attribute?

SEVERE: java.lang.RuntimeException: schema fieldtype
text(org.apache.solr.schema.TextField) invalid
arguments:{xml:base=solr/core2/conf/text-analyzer.xml}

This is what I'm trying to do (details of the analyzer chain omitted -
nothing unusual) - so the error occurs when the external xml file is
actually included:

<xi:include  href="solr/core2/conf/text-analyzer.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
  <xi:fallback>
    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
      <analyzer type="index">
...
      </analyzer>
      <analyzer type="query">
...
      </analyzer>
    </fieldType>
  </xi:fallback>
</xi:include>


Where (for testing) the text-analyzer.xml file just looks like the fallback:


<?xml version="1.0" encoding="UTF-8" ?>
    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
      <analyzer type="index">
...
      </analyzer>
      <analyzer type="query">
...
      </analyzer>
    </fieldType>


-- 
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com

Re: is it possible to use Xinclude in schema.xml?

Posted by David Stuart <da...@progressivealliance.co.uk>.
Yea i tried it as well it doesn't seem to implement xpointer properly  
so you can't add multiple fields or field types

David

On 28 Nov 2009, at 18:49, Peter Wolanin <pe...@acquia.com>  
wrote:

> Follow-up:  it seems the schema parser doesn't barf if you use
> xinclude with a single analyzer element, but so far seems like it's
> impossible for a field type.  So this seems to work:
>
>    <fieldType name="text" class="solr.TextField"  
> positionIncrementGap="100" >
> <xi:include  href="solr/core2/conf/text-analyzer.xml" >
>  <xi:fallback>
>      <analyzer type="index">
> ...
>      </analyzer>
>  </xi:fallback>
> </xi:include>
>      <analyzer type="query">
> ...
>      </analyzer>
>    </fieldType>
>
> On Sat, Nov 28, 2009 at 1:40 PM, Peter Wolanin <peter.wolanin@acquia.com 
> > wrote:
>> I'm trying to determine if it's possible to use Xinclude to (for
>> example) have a base schema file and then substitute various pieces.
>>
>> It seems that the schema fieldTypes throw exceptions if there is an
>> unexpected attribute?
>>
>> SEVERE: java.lang.RuntimeException: schema fieldtype
>> text(org.apache.solr.schema.TextField) invalid
>> arguments:{xml:base=solr/core2/conf/text-analyzer.xml}
>>
>> This is what I'm trying to do (details of the analyzer chain  
>> omitted -
>> nothing unusual) - so the error occurs when the external xml file is
>> actually included:
>>
>> <xi:include  href="solr/core2/conf/text-analyzer.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude" >
>>  <xi:fallback>
>>    <fieldType name="text" class="solr.TextField"  
>> positionIncrementGap="100" >
>>      <analyzer type="index">
>> ...
>>      </analyzer>
>>      <analyzer type="query">
>> ...
>>      </analyzer>
>>    </fieldType>
>>  </xi:fallback>
>> </xi:include>
>>
>>
>> Where (for testing) the text-analyzer.xml file just looks like the  
>> fallback:
>>
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>>    <fieldType name="text" class="solr.TextField"  
>> positionIncrementGap="100" >
>>      <analyzer type="index">
>> ...
>>      </analyzer>
>>      <analyzer type="query">
>> ...
>>      </analyzer>
>>    </fieldType>
>>
>>
>> --
>> Peter M. Wolanin, Ph.D.
>> Momentum Specialist,  Acquia. Inc.
>> peter.wolanin@acquia.com
>>
>
>
>
> -- 
> Peter M. Wolanin, Ph.D.
> Momentum Specialist,  Acquia. Inc.
> peter.wolanin@acquia.com

Re: is it possible to use Xinclude in schema.xml?

Posted by Peter Wolanin <pe...@acquia.com>.
Follow-up:  it seems the schema parser doesn't barf if you use
xinclude with a single analyzer element, but so far seems like it's
impossible for a field type.  So this seems to work:

    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
<xi:include  href="solr/core2/conf/text-analyzer.xml" >
  <xi:fallback>
      <analyzer type="index">
...
      </analyzer>
  </xi:fallback>
</xi:include>
      <analyzer type="query">
...
      </analyzer>
    </fieldType>

On Sat, Nov 28, 2009 at 1:40 PM, Peter Wolanin <pe...@acquia.com> wrote:
> I'm trying to determine if it's possible to use Xinclude to (for
> example) have a base schema file and then substitute various pieces.
>
> It seems that the schema fieldTypes throw exceptions if there is an
> unexpected attribute?
>
> SEVERE: java.lang.RuntimeException: schema fieldtype
> text(org.apache.solr.schema.TextField) invalid
> arguments:{xml:base=solr/core2/conf/text-analyzer.xml}
>
> This is what I'm trying to do (details of the analyzer chain omitted -
> nothing unusual) - so the error occurs when the external xml file is
> actually included:
>
> <xi:include  href="solr/core2/conf/text-analyzer.xml"
> xmlns:xi="http://www.w3.org/2001/XInclude" >
>  <xi:fallback>
>    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
>      <analyzer type="index">
> ...
>      </analyzer>
>      <analyzer type="query">
> ...
>      </analyzer>
>    </fieldType>
>  </xi:fallback>
> </xi:include>
>
>
> Where (for testing) the text-analyzer.xml file just looks like the fallback:
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
>    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" >
>      <analyzer type="index">
> ...
>      </analyzer>
>      <analyzer type="query">
> ...
>      </analyzer>
>    </fieldType>
>
>
> --
> Peter M. Wolanin, Ph.D.
> Momentum Specialist,  Acquia. Inc.
> peter.wolanin@acquia.com
>



-- 
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com