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

Reply via email to