You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by Joshua J Pavel <jp...@us.ibm.com> on 2012/02/04 20:49:23 UTC
Custom Plugin - Multiple Title values error
So, I'm writing a plugin to update the title from a non-standard field.
Nothing too fancy. I have a parse and an indexer class.
Following the example of index-more, and borrowing wisdom from the bug
report here (https://issues.apache.org/jira/browse/NUTCH-1140 ), this is a
portion of my code:
public NutchDocument filter(NutchDocument doc, Parse parse, Text url,
CrawlDatum datum, Inlinks inlinks) throws IndexingException {
String [] metatags = parse.getData().getParseMeta().getValues
(HtdigTitleParse.TAG_KEY);
if (metatags == null || metatags.length == 0) {
LOG.info("In HTDig indexer, but metatag is null.");
return doc;
}
for (String meta : metatags) {
LOG.info("Adding tag (" + HtdigTitleParse.TAG_KEY + ") : [" + meta +
"] for URL: " + url.toString());
doc.add(HtdigTitleParse.TAG_KEY, meta);
LOG.info("Replacing title with: " + meta );
doc.removeField("title");
doc.add("title", meta);
break;
}
return doc;
}
I get the value back and forth between the parser and the indexer through a
metatag entry. I'm not sure if there is a more efficient way to do this,
but that isn't my main concern. I'm stashing the value in a custom metatag
(added to my schema) as well right now.
My solr server gives this error:
[2/4/12 19:39:57:685 UTC] 00000047 SolrCore E
org.apache.solr.common.SolrException log
org.apache.solr.common.SolrException: ERROR: [doc=< URL >] multiple values
encountered for non multiValued field title: [ < MY NEW TITLE VALUE >, <
THE OLD DEFAULT TITLE FROM <title> TAGS > ]
at org.apache.solr.update.DocumentBuilder.toDocument
(DocumentBuilder.java:246)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd
(RunUpdateProcessorFactory.java:60)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd
(LogUpdateProcessorFactory.java:115)
at org.apache.solr.handler.XMLLoader.processUpdate
(XMLLoader.java:158)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:79)
at
org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody
(ContentStreamHandlerBase.java:58)
at org.apache.solr.handler.RequestHandlerBase.handleRequest
(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1372)
at org.apache.solr.servlet.SolrDispatchFilter.execute
(SolrDispatchFilter.java:356)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter
(SolrDispatchFilter.java:252)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter
(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter
(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest
(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest
(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest
(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest
(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest
(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready
(WCChannelLink.java:186)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination
(HttpInboundLink.java:452)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest
(HttpInboundLink.java:511)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest
(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready
(HttpInboundLink.java:276)
at
com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel
(SSLConnectionLink.java:1048)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink
$MyReadCompletedCallback.complete(SSLConnectionLink.java:642)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext
$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted
(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback
(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions
(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop
(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
I disabled the index-more incase that bug was affecting this as well, but
it is not... clearly my plugin. :-( I don't WANT to make title a
multiValued field. Anybody have any idea what I'm doing wrong? Thanks in
advance!