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 Dileepa Jayakody <di...@gmail.com> on 2013/12/13 09:29:49 UTC
Passing a Parameter to a Custom Processor
Hi All,
I have written a custom update-request processor and need to pass certain
parameters to the Processor.
I believe solrconfig.xml is the place to pass these parameters. At the
moment I define my parameter in the request handler as below;
<requestHandler name="/dataimport" class="solr.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
<str name="update.chain">stanbolInterceptor</str>
*<str name="stanbol.enhancer.url">http://localhost:8080/enhancer
<http://localhost:8080/enhancer></str>*
</lst>
</requestHandler>
My processor is defined in the stanbolInterceptor update.chain as below;
<updateRequestProcessorChain name="stanbolInterceptor"> <processor
class="com.solr.stanbol.processor.StanbolContentProcessorFactor" />
<processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
The stanbolInterceptor processor chain will be used in multiple request
handlers. Then I will have to pass the stanbol.enhancer.url param in each
of those request handler which will cause redundant configurations.
Therefore I need to pass the param to the processor directly.
But when I pass the params to the Processor as below the parameter is not
received to my ProcessorFactory class;
<processor class="com.solr.stanbol.processor.StanbolContentProcessorFactor *
<str name="stanbol.enhancer.url">http://localhost:8080/enhancer
<http://localhost:8080/enhancer></str>*
</processor>
Can someone point out what might be wrong here? Can someone please advice
on how to pass parameters directly to the Processor?
Thanks,
Dileepa
Re: Passing a Parameter to a Custom Processor
Posted by Dileepa Jayakody <di...@gmail.com>.
Thanks a lot for the info Koji. I'm going through the source-code, to find
out.
Regards,
Dileepa
On Fri, Dec 13, 2013 at 5:40 PM, Koji Sekiguchi <ko...@r.email.ne.jp> wrote:
> Hi Dileepa,
>
> The stanbolInterceptor processor chain will be used in multiple request
>> handlers. Then I will have to pass the stanbol.enhancer.url param in each
>> of those request handler which will cause redundant configurations.
>> Therefore I need to pass the param to the processor directly.
>>
>> But when I pass the params to the Processor as below the parameter is not
>> received to my ProcessorFactory class;
>> <processor class="com.solr.stanbol.processor.StanbolContentProcessorFactor
>> *
>>
>> <str name="stanbol.enhancer.url">http://localhost:8080/enhancer
>> <http://localhost:8080/enhancer></str>*
>>
>> </processor>
>>
>> Can someone point out what might be wrong here? Can someone please advice
>> on how to pass parameters directly to the Processor?
>>
>
> I don't know why your Processor cannot get the parameters, but Processor
> should
> get them. For example, StatelessScriptUpdateProcessorFactory can get
> script
> parameter like this:
>
> <processor class="solr.StatelessScriptUpdateProcessorFactory">
> <str name="script">updateProcessor.js</str>
> </processor>
>
> http://lucene.apache.org/solr/4_5_0/solr-core/org/apache/
> solr/update/processor/StatelessScriptUpdateProcessorFactory.html
>
> So why don't you consult the source code of StatelessScriptUpdateProcessorFactory,
> etc?
>
> koji
> --
> http://soleami.com/blog/automatically-acquiring-synonym-knowledge-from-
> wikipedia.html
>
Re: Passing a Parameter to a Custom Processor
Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Hi Dileepa,
> The stanbolInterceptor processor chain will be used in multiple request
> handlers. Then I will have to pass the stanbol.enhancer.url param in each
> of those request handler which will cause redundant configurations.
> Therefore I need to pass the param to the processor directly.
>
> But when I pass the params to the Processor as below the parameter is not
> received to my ProcessorFactory class;
> <processor class="com.solr.stanbol.processor.StanbolContentProcessorFactor *
> <str name="stanbol.enhancer.url">http://localhost:8080/enhancer
> <http://localhost:8080/enhancer></str>*
> </processor>
>
> Can someone point out what might be wrong here? Can someone please advice
> on how to pass parameters directly to the Processor?
I don't know why your Processor cannot get the parameters, but Processor should
get them. For example, StatelessScriptUpdateProcessorFactory can get script
parameter like this:
<processor class="solr.StatelessScriptUpdateProcessorFactory">
<str name="script">updateProcessor.js</str>
</processor>
http://lucene.apache.org/solr/4_5_0/solr-core/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactory.html
So why don't you consult the source code of StatelessScriptUpdateProcessorFactory, etc?
koji
--
http://soleami.com/blog/automatically-acquiring-synonym-knowledge-from-wikipedia.html