lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (SOLR-2436) move uimaConfig to under the uima's update processor in solrconfig.xml
Date Wed, 13 Apr 2011 18:16:05 GMT

    [ https://issues.apache.org/jira/browse/SOLR-2436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019470#comment-13019470
] 

Uwe Schindler edited comment on SOLR-2436 at 4/13/11 6:14 PM:
--------------------------------------------------------------

Here is the new way to load XML from ResourceLoaders in Solr (taken from Config). This code
also intercepts errors and warnings and logs them correctly (parsers tend to write them to
System.err):

{code:java}
public static final Logger log = LoggerFactory.getLogger(Config.class);
private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);

...

final InputSource is = new InputSource(loader.openConfig(name));
is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));

final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// only enable xinclude, if a SystemId is available
if (is.getSystemId() != null) {
	try {
		dbf.setXIncludeAware(true);
		dbf.setNamespaceAware(true);
	} catch(UnsupportedOperationException e) {
		log.warn(name + " XML parser doesn't support XInclude option");
	}
}

final DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver(new SystemIdResolver(loader));
db.setErrorHandler(xmllog);
try {
	doc = db.parse(is);
} finally {
	// some XML parsers are broken and don't close the byte stream (but they should according
to spec)
	IOUtils.closeQuietly(is.getByteStream());
}
{code}

      was (Author: thetaphi):
    Here is the new way to load XML from ResourceLoaders in Solr (taken from Config). This
code also intercepts errors and warnings and logs them correctly (parsers tend to write them
to System.err):

{code:java}
is = new InputSource(loader.openConfig(name));
is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));


// only enable xinclude, if a SystemId is available
if (is.getSystemId() != null) {
	try {
		dbf.setXIncludeAware(true);
		dbf.setNamespaceAware(true);
	} catch(UnsupportedOperationException e) {
		log.warn(name + " XML parser doesn't support XInclude option");
	}
}

final DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver(new SystemIdResolver(loader));
db.setErrorHandler(xmllog);
try {
	doc = db.parse(is);
} finally {
	// some XML parsers are broken and don't close the byte stream (but they should according
to spec)
	IOUtils.closeQuietly(is.getByteStream());
}
{code}
  
> move uimaConfig to under the uima's update processor in solrconfig.xml
> ----------------------------------------------------------------------
>
>                 Key: SOLR-2436
>                 URL: https://issues.apache.org/jira/browse/SOLR-2436
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Koji Sekiguchi
>            Priority: Minor
>         Attachments: SOLR-2436-3.patch, SOLR-2436.patch, SOLR-2436.patch, SOLR-2436.patch,
SOLR-2436_2.patch
>
>
> Solr contrib UIMA has its config just beneath <config>. I think it should move
to uima's update processor tag.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message