Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9479

Extends DIH with transformation on Solr document level

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      I use DIH to index nested documents.
      I have couple of use cases where field values on parent document depend on children documents values. The simplest one - I need to "propagate" values from all children documents to new field on parent document. It could be a little bit tricky with current DIH architecture when you can apply transformation for "plain" documents which considered as a plain map. See org.apache.solr.handler.dataimport.Transformer (You have to use some kind of "transient fields" in your data-config, this fields are populated from child sources, so sometimes you have to read child sources twice (or more times) for this. Maybe I do it wrong?)

      I decided that maybe it makes sense to be able to apply transformation after nested documents were converted from collection of maps into good old hierarchical SolrInputDocument.

      So this initial patch was created:

      • It introduces concept of DocumentTransformer with Java interface
        SolrInputDocument transform(SolrInputDocument solrDoc, Context context) 
      • This interface should be implemented by clients transformers. One simple example of such transformer, PropagationDocumentTransformer, is implemented. It parametrised by two field names - child and parent, and copied values from children documents to parent document.
      • This kind of transformer should be added into data-config.xml to corresponding parents entry:
      documentTransformer="org.apache.solr.handler.dataimport.PropagationDocumentTransformer"

      Attachments

        1. SOLR-9479.patch
          16 kB
          Andrey Kudryavtsev

        Issue Links

          Activity

            People

              Unassigned Unassigned
              werder Andrey Kudryavtsev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: