Thursday, June 27, 2013

Added some scripting update processor examples to EAR#2 of the book

Over the past two days I have added some examples of scripted update processors to EAR#2 of the book, due out at the end of next week. They use the Solr StatelessScriptUpdateProcessorFactory class to run JavaScript scripts when documents are being indexed.
 
One set of examples, using the "split-string" script to split a single input string for a field into a list of strings for a multivalued field based on a character delimiter, such as comma, slash, or newline, or based on a regular expression pattern.
 
The other set of examples use the "normalize-date" script to do one of two things: 1) expand abbreviated dates into full ISO dates, such as "2012" (year only), "2012-04-15" (day only), and "2012-04-15T01:02:03" (missing trailing "Z"), and 2) to truncate data values based on some unit, such as day (ignore the time), year (ignore the month, day, and time), etc. The latter is great for field facets to limit the number of unique values, such as for pivot facets.

-- Jack Krupansky

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home