From e723f7fbad506ad721b0c362123b19e4917b61ba Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Fri, 11 Sep 2009 06:34:35 +0000 Subject: [PATCH] SOLR-1421 FieldreaderDataSource uses a stale Variableresolver git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@813676 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/handler/dataimport/EntityProcessorWrapper.java | 8 ++++++++ .../solr/handler/dataimport/FieldReaderDataSource.java | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java index 9a5eda12335..365cb321147 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java @@ -271,6 +271,14 @@ public class EntityProcessorWrapper extends EntityProcessor { contextCopy = null; } + public VariableResolverImpl getVariableResolver() { + return resolver; + } + + public Context getContext() { + return context; + } + @Override public void close() { delegate.close(); diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java index a89aed2d38b..388f874c196 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java @@ -52,16 +52,17 @@ public class FieldReaderDataSource extends DataSource { protected VariableResolver vr; protected String dataField; private String encoding; + private EntityProcessorWrapper entityProcessor; public void init(Context context, Properties initProps) { - vr = context.getVariableResolver(); dataField = context.getEntityAttribute("dataField"); encoding = context.getEntityAttribute("encoding"); + entityProcessor = (EntityProcessorWrapper) context.getEntityProcessor(); /*no op*/ } public Reader getData(String query) { - Object o = vr.resolve(dataField); + Object o = entityProcessor.getVariableResolver().resolve(dataField); if (o == null) { throw new DataImportHandlerException (SEVERE, "No field available for name : " +dataField); }