Hi Sharma,
I guess you are looking for nested documents: 
https://lucene.apache.org/solr/guide/6_6/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-NestedChildDocuments
 
<https://lucene.apache.org/solr/guide/6_6/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-NestedChildDocuments>

It seems DIH supports it since versions 5.1: 
https://issues.apache.org/jira/browse/SOLR-5147 
<https://issues.apache.org/jira/browse/SOLR-5147>

Regards,
Emir

> On 2 Oct 2017, at 10:50, Deeksha Sharma <dsha...@flexera.com> wrote:
> 
> Hi everyone,
> 
> 
> I have created a core and index data in Solr using dataImportHandler.
> 
> 
> The schema for the core looks like this:
> 
> <field name="md5"             type="string" indexed="true" stored="true" 
> required="true"/>
> 
>    <field name="rules"          type="string" indexed="true" stored="true" 
> required="true"/>
> 
> 
> 
> This is my data in mysql database:
> 
> 
> md5:"0000376463475574058bba96395bfb87"
> 
> 
> rules: 
> {"fileRules":[{"file_id":1321241,"md5":"0000376463475574058bba96395bfb87","group_id":69253,"filecdata1":{"versionId":3382858,"version":"1.2.1","detectionNotes":"Generated
>  from Ibiblio Maven2, see URL 
> (http://maven.ibiblio.org/maven2/sk/seges/acris/acris-security-hibernate).","texts":[{"shortText":null,"header":"Sample
>  from URL 
> (http://maven.ibiblio.org/maven2/sk/seges/acris/acris-os-parent/1.2.1/acris-os-parent-1.2.1.pom)","text":"<license>
>        <name>The Apache Software License, Version 2.0</name>
>        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
>        <distribution>repo</distribution>
> </license>"}],"notes":[],"forge":"Ibiblio 
> Maven2"}}],"groupRules":[{"group_id":69253,"parent":-1,"component":"sk.seges.acris/acris-security-hibernate
>  - AcrIS Security with Hibernate metadata","license":"Apache 
> 2.0","groupcdata1":{"componentId":583560,"title":"sk.seges.acris/acris-security-hibernate
>  - Ibiblio 
> Maven2","licenseIds":[20],"priority":3,"url":"http://maven.ibiblio.org/maven2/sk/seges/acris/acris-security-hibernate","displayName":"AcrIS
>  Security with Hibernate 
> metadata","description":null,"texts":[],"notes":[],"forge":"Ibiblio 
> Maven2"}}]}
> 
> Query results from Solr:
> 
> { "responseHeader":{ "status":0, "QTime":0, "params":{ 
> "q":"md5:000003bb576a6b6e001cd94e91ad4c29", "indent":"on", "wt":"json", 
> "_":"1506933082656"}}, "response":{"numFound":1,"start":0,"docs":[ { 
> "rules":"{\"fileRules\":[{\"file_id\":7328190,\"md5\":\"000003bb576a6b6e001cd94e91ad4c29\",\"group_id\":241307,\"filecdata1\":{\"versionId\":15761972,\"version\":\"1.0.2\",\"detectionNotes\":null,\"texts\":[{\"shortText\":null,\"header\":\"The
>  following text is found at URL 
> (https://www.nuget.org/packages/HangFire.Redis/1.0.2)\",\"text\":\"License 
> details:\nLGPL-3.0\"}],\"notes\":[],\"forge\":\"NuGet 
> Gallery\"}}],\"groupRules\":[{\"group_id\":241307,\"parent\":-1,\"component\":\"HangFire.Redis\",\"license\":\"LGPL
>  
> 3.0\",\"groupcdata1\":{\"componentId\":3524318,\"title\":null,\"licenseIds\":[216],\"priority\":1,\"url\":\"https://www.nuget.org/packages/HangFire.Redis\",\"displayName\":\"Hangfire
>  Redis Storage [DEPRECATED]\",\"description\":\"DEPRECATED -- DO NOT INSTALL 
> OR UPDATE. Now shipped with Hangfire Pro, please read the \"Project site\" 
> (http://odinserj.net/2014/11/15/hangfire-pro/) for more 
> information.\",\"texts\":[{\"shortText\":null,\"header\":\"License details 
> history:\n(Refer to https://www.nuget.org/packages/HangFire.Redis and select 
> the desired version for more information)\",\"text\":\"LGPL-3.0 - (for 
> HangFire.Redis versions 0.7.0, 0.7.1, 0.7.3, 0.7.4, 0.7.5, 0.8.0, 0.8.1, 
> 0.8.2, 0.8.3, 0.9.0, 0.9.1, 1.0.1, 1.0.0, 1.0.2)\nNo information - (for 
> HangFire.Redis versions 1.1.1, 2.0.1, 
> 2.0.0)\"}],\"notes\":[{\"header\":null,\"text\":\"Project Site: 
> http://odinserj.net/2014/11/15/hangfire-pro\"},{\"header\":\"Previous Project 
> Sites\",\"text\":\"https://github.com/odinserj/HangFire - (for Hangfire Redis 
> Storage [DEPRECATED] version 0.7.0)\nhttp://hangfire.io - (for Hangfire Redis 
> Storage [DEPRECATED] versions 0.7.1, 0.7.3, 0.7.4, 0.7.5, 0.8.0, 0.8.1, 
> 0.8.2, 0.8.3, 0.9.0, 0.9.1, 1.0.1, 1.0.0, 1.0.2, 1.1.1)\nNo information - 
> (for Hangfire Redis Storage [DEPRECATED] versions 2.0.1, 
> 2.0.0)\"},{\"header\":\"License 
> links\",\"text\":\"https://raw.github.com/odinserj/HangFire/master/COPYING.LESSER
>  - (for HangFire.Redis version 
> 0.7.0)\nhttps://raw.github.com/odinserj/HangFire/master/LICENSE.md - (for 
> HangFire.Redis versions 0.7.1, 0.7.3, 0.7.4, 0.7.5, 0.8.0, 0.8.1, 0.8.2, 
> 0.8.3, 0.9.0, 
> 0.9.1)\nhttps://raw.github.com/odinserj/Hangfire/master/LICENSE.md - (for 
> HangFire.Redis versions 1.0.1, 1.0.0, 
> 1.0.2)\nhttps://raw.github.com/HangfireIO/Hangfire/master/LICENSE.md - (for 
> HangFire.Redis version 1.1.1)\nNo information - (for HangFire.Redis versions 
> 2.0.1, 2.0.0)\"}],\"forge\":\"NuGet Gallery\"}}]}", 
> "md5":"000003bb576a6b6e001cd94e91ad4c29", "_version_":1579807444777828352}] }}
> 
> 
> 
> Now when I receive the results from Solr query, it returns me the String for 
> rules. How can I tell Solr to index rules as JSON and return a valid JSON 
> instead of escaped String ?
> 
> Any help is greatly appreciated.
> Thanks!
> 

Reply via email to