How to enable or disable component based on document field value in solrconfig.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to enable or disable component based on document field value in solrconfig.xml

sarat chandra
 We have a use case where we need to populate uniq field from multiple
fields. Our solrconfig.xml file like below.

*<updateRequestProcessorChain name="updateProcess">*
*       <processor class="solr.CloneFieldUpdateProcessorFactory">*
* <str name="source">Code</str>*
* <str name="dest">FullCode</str>*
*       </processor>*
* <processor class="solr.CloneFieldUpdateProcessorFactory">*
* <str name="source">ExtendedCode</str>*
* <str name="dest">FullCode</str>*
*       </processor>*
*    <processor class="solr.ConcatFieldUpdateProcessorFactory">*
* <str name="delimiter">_</str>*
* <str name="fieldName">FullCode</str>*
* </processor>*
*    </updateRequestProcessorChain>*
The above configuration works fine if the document has both Code and
ExtendedCode. But For some of the documents we don't have ExtendedCode. For
those cases we are getting the error like Mandatory field not provided.

How we need to modify the configuration to support both scenarios.
i tried with below but no luck.
<processor class="solr.CloneFieldUpdateProcessorFactory"
enable="${ExtendedCode}" >
<str name="source">ExtendedCode</str>
<str name="dest">FullCode</str>
       </processor>


Depend on the Field value, i need to enable or disable the processor
dynamically.

how can i achieve this kind of behavior ? , Thanks

--
--with regards
SARAT CHANDRA
Reply | Threaded
Open this post in threaded view
|

Re: How to enable or disable component based on document field value in solrconfig.xml

Erick Erickson
Have you considered the StatelessScriptUpdateProcessorFactory? That
allows you to do pretty much anything you want.

Don't quite know whether TemplateUPdateProcessorFactory deals well
with empty fields or not, but it might be worth a shot.

And, of course, your ETL process could to that on the client side, but
sounds like that's not really a good option.

Best,
Erick

On Fri, Apr 13, 2018 at 3:22 AM, sarat chandra
<[hidden email]> wrote:

>  We have a use case where we need to populate uniq field from multiple
> fields. Our solrconfig.xml file like below.
>
> *<updateRequestProcessorChain name="updateProcess">*
> *       <processor class="solr.CloneFieldUpdateProcessorFactory">*
> * <str name="source">Code</str>*
> * <str name="dest">FullCode</str>*
> *       </processor>*
> * <processor class="solr.CloneFieldUpdateProcessorFactory">*
> * <str name="source">ExtendedCode</str>*
> * <str name="dest">FullCode</str>*
> *       </processor>*
> *    <processor class="solr.ConcatFieldUpdateProcessorFactory">*
> * <str name="delimiter">_</str>*
> * <str name="fieldName">FullCode</str>*
> * </processor>*
> *    </updateRequestProcessorChain>*
> The above configuration works fine if the document has both Code and
> ExtendedCode. But For some of the documents we don't have ExtendedCode. For
> those cases we are getting the error like Mandatory field not provided.
>
> How we need to modify the configuration to support both scenarios.
> i tried with below but no luck.
> <processor class="solr.CloneFieldUpdateProcessorFactory"
> enable="${ExtendedCode}" >
> <str name="source">ExtendedCode</str>
> <str name="dest">FullCode</str>
>        </processor>
>
>
> Depend on the Field value, i need to enable or disable the processor
> dynamically.
>
> how can i achieve this kind of behavior ? , Thanks
>
> --
> --with regards
> SARAT CHANDRA