6

I'm Working with Solr 7.4.0 and using DIH Method For Indexing the Data.

Query in data-config.xml.

<entity name="Test" query="Select Names,Test_Value1,Test_Value2,Test_Value3 from TestTable">

        <field column="Names" name="Names" splitBy="," />
        <field column="Test_*" name="Test_*" splitBy="," />
</entity>

Schema.xml

<field name="Names" type="string" multiValued="true" indexed="true" />
<dynamicField name="Test_*" type="string" multiValued="true" indexed="true" />

After Completing the Indexing, Names easily gets separated as below and showing values as multiValue as required.
e.g

"Names":["Demo1",
          "Demo2"]

But When Working With dynamic Field as string type multiValue. Its Showing this result in Indexing.

"Test_Value1":["Test 1, Test 2, Test 3"],         

But I need this result as below.

"Test_Value1":["Test 1", "Test 2", "Test 3"],

How would separate the Values of Dynamic Field Values as shown above.

Krunal
  • 2,967
  • 8
  • 45
  • 101
rakesh girase
  • 140
  • 1
  • 8
  • 1
    Have you considered [using a script transformer instead](https://lucene.apache.org/solr/guide/6_6/uploading-structured-data-store-data-with-the-data-import-handler.html#the-scripttransformer)? The `field` definition in DIH can't match multiple fields as far as I know, but the script transformer will allow you to have a regex that matches the input field names and split the string into multiple values if it matches. – MatsLindh Sep 12 '18 at 19:00
  • Thank you for reply My field name is dynamic so i can not put static field in transformer so this will not solve my problem – rakesh girase Sep 17 '18 at 13:33
  • But that doesn't matter - it just has to be active on _one_ field, so in your example above it can be added to the `Names` field. – MatsLindh Sep 17 '18 at 19:34

0 Answers0