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 A. Kirk" <pk...@alpha-solutions.dk> on 2010/10/20 00:32:58 UTC

xi:include

Hi

I am trying to use xi:include in my solrconfig.xml.

For example:
<xi:include href="http://localhost/config/config.aspx" />

This works fine, as long as config.aspx exists, and as long as it returns valid xml.

Sometimes though, the config.aspx can fail, and return invalid xml. Then I get a problem, as Solr's parsing of the solrconfig.xml fails. If I use xi:fallback, eg:

<xi:include href="http://localhost/config/config.aspx">
  <xi:fallback>
    <str name="qf">
      text^0.4 n^1.2 c^1.5 d^0.4 b^3
    </str>
  </xi:fallback>
</xi:include>

This helps if config.xml does not exist - then the fallback is used. But if config.aspx returns invalid xml, then the fallback does not appear to be used, and I get exceptions when I start Solr up. How can I get Solr to fallback if the included xml fails?

Thanks,
Peter


RE: xi:include

Posted by "Peter A. Kirk" <pk...@alpha-solutions.dk>.
Hi

Thanks for your reply. In actual fact, the "config.aspx" will either return a valid xml, or it will return an empty string - and unfortunately an empty string is not considered valid xml by the Solr xml parser.

The "config.aspx" is a rather general application, returning all sorts of data, depending on the parameters supplied to it. It doesn't know what fallback xml is appropriate in a specific instance.

For example, it might be called like this:
http://localhost/config/config.aspx?id=core1dismax&weight=qf

But if configuration in solrconfig.xml is entered incorrectly (eg maybe the "id" parameter to config.aspx is incorrect) then config.aspx returns an empty string.

Other xml parsers which handle x:include, and xi:fallback, actually invoke the fallback if any error occurs during the include (not only if the include resource does not exist). Is it possible to configure the Solr parser so it invokes the fallback on any error?

Thanks,
Peter

________________________________________
From: Stefan Matheis [matheis.stefan@googlemail.com]
Sent: Wednesday, 20 October 2010 22:05
To: solr-user@lucene.apache.org
Subject: Re: xi:include

Wouldn't it be easier to ensure, that your config.aspx returns valid
xml? Wrap your existing Code with some Exception-Handling and return your
fallback-xml if something goes wrong?

Re: xi:include

Posted by Stefan Matheis <ma...@googlemail.com>.
Wouldn't it be easier to ensure, that your config.aspx returns valid
xml? Wrap your existing Code with some Exception-Handling and return your
fallback-xml if something goes wrong?