Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by NoblePaul: http://wiki.apache.org/solr/DataImportHandler ------------------------------------------------------------------------------ </entity> }}} - ==== Attributes required by RegexTransformer ==== + ==== Attributes ==== !RegexTransfromer applies only on the fields with an attribute 'regex' or 'splitBy'. All other fields are left as it is. * '''`regex`''' : The regular expression that is used to match . This or `splitBy` must be present for each field . If not, that field is not touched by the transformer . If `replaceWith` is absent, each ''group'' is taken as a value and a list of values is returned - * '''`sourceColName`''' : The column on which the regex is to be applied. If there is only one column this can be omitted + * '''`sourceColName`''' : The column on which the regex is to be applied. If this is absent source and target are same * '''`splitBy`''' : If the `regex` is used to split a String to obtain multipple values use this * '''`replaceWith`''' : Used alongwith `regex` . It is equivalent to the method `new String(<sourceColVal>).replaceAll(<regex>, <replaceWith>)` Here the attributes 'regex' and 'sourceColName' are custom attributes used by the transformer. It reads the field 'full_name' from the resultset and transform it to two target fields 'firstName' and 'lastName' . So even though the query returned only one column 'full_name' in the resultset the solr document gets two extra fields 'firstName' and 'lastName' wich are 'derived' fields. @@ -454, +454 @@ [[Anchor(DateFormatTransformer)]] === DateFormatTransformer === There is a built-in transformer called the !DateFormatTransformer which is useful for parsing date/time strings into java.util.Date instances. + + {{{ + <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" /> + }}} + + ==== Attributes ==== !DateFormatTransformer applies only on the fields with an attribute 'dateTimeFormat' . All other fields are left as it is. + * '''`dateTimeFormat`''' : The format used for parsing this field. This must comply with the syntax of java [http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html SimpleDateFormat]. + * '''`sourceColName`''' : The column on which the dateFormat is to be applied. If this is absent source and target are same + The above field definition is used in the RSS example to parse the publish date of the RSS feed item. - {{{ - <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" /> - }}} - - - The above field definition is used in the RSS example to parse the publish date of the RSS feed item. The transformer only applies to a field which has the attribute 'dateTimeFormat' and it uses the syntax of java's [http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html SimpleDateFormat]. === NumberFormatTransformer === Can be used to parse a number from a String. Uses the !NumberFormat class in java @@ -469, +472 @@ {{{ <field column="price" formatStyle="number" /> }}} - !DateFormatTransformer applies only on the fields with an attribute 'formatStyle' . All other fields are left as it is. The value of the attribute must be one of (number|percent|integer|currency). + + ==== Attributes ==== + !NumberFormatTransformer applies only on the fields with an attribute 'formatStyle' . + * '''`formatStyle`''' : The format used for parsing this field The value of the attribute must be one of (number|percent|integer|currency). This uses the semantics of java [http://java.sun.com/j2se/1.4.2/docs/api/java/text/NumberFormat.html NumberFormat]. + * '''`sourceColName`''' : The column on which the !NumberFormat is to be applied. If this is absent source and target are same + == EntityProcessor == Each entity is handled by a default Entity processor called !SqlEntityProcessor. This works well for systems which use RDBMS as a datasource. For other kind of datasources like REST or Non Sql datasources you can choose to implement this interface `org.apache.solr.handler.dataimport.Entityprocessor` {{{
