Oh yeah. Hi have seen that Processor on the book and i was not able to remember. Thanks a lot. And thanks a lot for your solution. It works :)
On Aug 8, 2013, at 1:52 AM, "Jack Krupansky" <j...@basetechnology.com> wrote: > Here's the actual update processor I used (and tested): > > <updateRequestProcessorChain name="first-default-field"> > <processor class="solr.CloneFieldUpdateProcessorFactory"> > <str name="source">main_s</str> > <str name="dest">final_s</str> > </processor> > <processor class="solr.CloneFieldUpdateProcessorFactory"> > <str name="source">backup_s</str> > <str name="dest">final_s</str> > </processor> > <processor class="solr.FirstFieldValueUpdateProcessorFactory"> > <str name="fieldName">final_s</str> > </processor> > <processor class="solr.LogUpdateProcessorFactory" /> > <processor class="solr.RunUpdateProcessorFactory" /> > </updateRequestProcessorChain> > > -- Jack Krupansky > > -----Original Message----- From: Jack Krupansky > Sent: Wednesday, August 07, 2013 8:20 PM > To: solr-user@lucene.apache.org > Subject: Re: SOLR Copy field if no value on destination > > Sorry, I am unable to untangle the logic you are expressing, but I can can > assure you that JavaScript and the StatelessScriptUpdate processor has full > support for implementing spaghetti code logic as tangled as desired! > > Simpler forms of logic can be implemented directly using non-script update > processor sequences, but once you start adding conditionals, there is a 50% > chance that you will need a script. > > There is a Default Value update processor, but it takes a literal value. > > Hmmm... maybe I’ll come up with a “default-value” script that takes a field > name for the default value. IOW, it would copy a specified field to the > destination IFF the destination had no value. > > Ahhh... wait... maybe... you could do this with the First Value Update > processor: > > 1. Copy guid to FinalLink. (Clone Update processor). > 2. Copy link to FinalLink. (Clone Update processor). > 3. First Value Update processor. > > So, step 3 would leave link if guid was not there, or keep guid if it is > there and discard link. > > Yes, that should do it. > > This is worth an example in the book! Thanks for the inspiration! > > -- Jack Krupansky > > From: Luís Portela Afonso > Sent: Wednesday, August 07, 2013 7:22 PM > To: solr-user@lucene.apache.org > Subject: SOLR Copy field if no value on destination > > Hi, > > Is possible to copy a value of a field to another if the destination doesn't > have value? > An example: > a.. Indexing an rss > b.. The feed has the fields link and guid, but sometimes guid cannot be > present in the feed > c.. I have a field that i will copy values with the name finalLink > > Now i want to copy guid to finalLink, but if guid has not value i want to > copy link. > > My question is, is that possible just with the schema, Processors, > solrconfig.xml, and the data-config? > > Thanks a lot
smime.p7s
Description: S/MIME cryptographic signature