11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ScriptTransformer<br />

TemplateTransformer<br />

Write transformers in Javascript or any other scripting language supported by<br />

Java.<br />

Transform a field using a template.<br />

These transformers are described below.<br />

ClobTransformer<br />

You can use the ClobTransformer to create a string out of a CLOB in a database. A CLOB is a character large<br />

object: a collection of character data typically stored in a separate location that is referenced in the database.<br />

See http://en.wikipedia.org/wiki/Character_large_object. Here's an example of invoking the ClobTransformer.<br />

<br />

<br />

...<br />

<br />

The ClobTransformer accepts these attributes:<br />

clob<br />

Attribute<br />

sourceColName<br />

Description<br />

Boolean value to signal if ClobTransformer should process this field or not. If this attribute is<br />

omitted, then the corresponding field is not transformed.<br />

The source column to be used as input. If this is absent source and target are same<br />

The DateFormatTransformer<br />

This transformer converts dates from one format to another. This would be useful, for example, in a situation<br />

where you wanted to convert a field with a fully specified date/time into a less precise date format, for use in<br />

faceting.<br />

DateFormatTransformer applies only on the fields with an attribute dateTimeFormat. Other fields are not<br />

modified.<br />

This transformer recognizes the following attributes:<br />

Attribute<br />

dateTimeFormat<br />

sourceColName<br />

locale<br />

Description<br />

The format used for parsing this field. This must comply with the syntax of the Java<br />

SimpleDateFormat class.<br />

The column on which the dateFormat is to be applied. If this is absent source and target<br />

are same.<br />

The locale to use for date transformations. If not specified, the ROOT locale will be used. It<br />

must be specified as language-country. For example, en-US.<br />

Here is example code that returns the date rounded up to the month "2007-JUL":<br />

<br />

...<br />

<br />

<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

222

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!