is it possible to use Xinclude in schema.xml?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

is it possible to use Xinclude in schema.xml?

Peter Wolanin-2
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.
[hidden email]
Reply | Threaded
Open this post in threaded view
|

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

Peter Wolanin-2
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 <[hidden email]> 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.
> [hidden email]
>



--
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
[hidden email]
Reply | Threaded
Open this post in threaded view
|

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

David Stuart
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 <[hidden email]>  
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 <[hidden email]
> > 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.
>> [hidden email]
>>
>
>
>
> --
> Peter M. Wolanin, Ph.D.
> Momentum Specialist,  Acquia. Inc.
> [hidden email]