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 ------------------------------------------------------------------------------ It moves ahead and encounters `/RDF/item` and processes the rows one by one . It gets the values for all the fields except for the 3 fields in the header. But as they were marked as common fields, the processor puts those fields into the record just before creating the document. - What about this ''transformer=!DateFormatTransformer'' attribute in the entity? . See !DateFormatTransformer Section for details + What about this ''transformer=!DateFormatTransformer'' attribute in the entity? . See [#DateFormatTransformer DateFormatTransformer] Section for details You can use this feature for indexing from REST API's such as rss/atom feeds, XML data feeds , other SOLR servers or even well formed xhtml documents . Our XPath support has its limitations but we have tried to make sure that common use-cases are covered and since it's based on a streaming parser, it is extremely fast and consumes constant amount of memory even for large XMLs. It does not support namespaces , but it can handle xmls with namespaces . When you provide the xpath, just drop the namespace and give the rest (eg if the tag is `'<dc:subject>'` the mapping should just contain `'subject'`).Easy, isn't it? And you didn't need to write one line of code! Enjoy :) = Extending the tool with APIs = @@ -512, +512 @@ * Write as many transformer functions as you want to use. Each such function must accept a ''row'' variable corresponding to ''Map<String, Object>'' and return a row (after applying transformations) * Make an entity use a function by specifying ''transformer="script:<function-name>"'' in the ''entity'' node. * In the above data-config, the javascript function ''f1'' will be executed once for each row returned by entity e. - * The semantics of execution is same as that of a java transformer. The method can have two arguments as in 'transformRow(Map<String,Object> , Context context) in the interface 'Transformer' . As it is javascript the second argument may be omittted and it still works + * The semantics of execution is same as that of a java transformer. The method can have two arguments as in 'transformRow(Map<String,Object> , Context context) in the interface 'Transformer' . As it is javascript the second argument may be omittted and it still works. + [[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. !DateFormatTransformer applies only on the fields with an attribute 'dateTimeFormat' . All other fields are left as it is. @@ -627, +628 @@ While the namespace concept is useful , the user may want to put some computed value into the query or url for example there is a Date object and your datasource accepts Date in some custom format . There are a few functions provided by the !DataImportHandler which can do some of these. * ''formatDate'' : It is used like this `'${dataimporter.functions.formatDate(item.ID, yyyy-MM-dd HH:mm)}'` . The first argument can be a valid value from the !VariableResolver and the second cvalue can be a a format string (use !SimpledateFormat) . The first argument can be a computed value eg: `'${dataimporter.functions.formatDate('NOW-3DAYS', yyyy-MM-dd HH:mm)}'` and it uses the syntax of the datemath parser in Solr. (note that it must enclosed in single quotes) * ''escapeSql'' : Use this to escape special sql characters . eg : `'${dataimporter.functions.escapeSql(item.ID)}'` . Takes only one argument and must be a valid value in the !VaraiableResolver. - * ''encodeUrl'' : Us this to encode urls . eg : `'${dataimporter.functions.encodeUrl(item.ID)}'` . Takes only one argument and must be a valid value in the !VaraiableResolver + * ''encodeUrl'' : Us this to encode urls . eg : `'${dataimporter.functions.encodeUrl(item.ID)}'` . Takes only one argument and must be a valid value in the !VariableResolver
