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 The comment on the change is: row and variableresolver definitions ------------------------------------------------------------------------------ <dataConfig> <document name="products"> <entity name="item" pk="ID" query="select * from item"> + + ---- /!\ '''Edit conflict - other version:''' ---- <entity name="feature" query="select description as features from feature where item_id='${item.ID}'"/> <entity name="item_category" query="select category_id from item_category where item_id='${item.ID}'"> <entity name="category" query="select description as cat from category where id = '${item_category.CATEGORY_ID}'"/> + + ---- /!\ '''Edit conflict - your version:''' ---- + <entity name="feature" query="select description as features from feature where item_id='${item.ID}'"/> + <entity name="item_category" query="select category_id from item_category where item_id='${item.ID}'"> + <entity name="category" query="select description as cat from category where id = '${item_category.CATEGORY_ID}'"/> + + ---- /!\ '''End of edit conflict''' ---- </entity> </entity> </document> @@ -614, +623 @@ + ---- /!\ '''Edit conflict - other version:''' ---- + == What is a row? == + A row in !DataImportHandler is a Map (Map<String, Object). In the map , the key is the name of the field and the value can be anything which is a valid Solr type. The value can also be a Collection of the valid Solr types (this may get mapped to a multi-valued field). If the DataSource is RDBMS a query cannot emit a multivalued field. But it is possible to create a multivalued field by joining an entity with another.i.e if the sub-entity returns multiple rows for one row from parent entity it can go into a multivalued field. If the datadource is xml it is possible to return a multivalued field. + + == A VariableResolver == + A !VariableResolver is the component which replaces all those placholders such as `${<name>}`. It is a multilevel Map .Each namespace is a Map and namespaces are separated by periods (.) . eg if there is a placeholder ${item.ID} , 'item' is a nampespace (which is a map) and 'ID' is a value in that namespace. It is possible to nest namespaces like ${item.x.ID} where x could be another Map. A reference to the current !VariableResolver can be obtained from the Context. Or the object can be directly consumed by using ${<name>} in 'query' for RDMS queries or 'url' in Http . + + + + ---- /!\ '''Edit conflict - your version:''' ---- + + ---- /!\ '''End of edit conflict''' ---- + = Where to find it? = DataImportHandler is not in SOLR right now. You can either: * Download the patch in [http://issues.apache.org/jira/browse/SOLR-469 SOLR-469] in the SOLR JIRA, or
