lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Pitsounis <michael.pitsou...@gmail.com>
Subject Re: embedded documents
Date Mon, 25 Aug 2014 18:23:08 GMT
Hi Jack,


I uploaded the code for a friend here
http://www.solrfromscratch.com/2014/08/20/embedded-documents-in-solr/  [it
is not the latest code,  i will update it  in a couple of hours  ]

Multilevel nesting is supported,

in case of arrays e.g

personalities_json:[
  {id:5},
  {id:3}
]

initially I flattened to

personalities.0.id:5
personalities.1.id:3

BUT it is not that useful at the end, because you cannot query. So I
removed the index and I store them on a multivalue field

personalities.id:5
personalities.id:3






Regards,
M.





On Sun, Aug 24, 2014 at 2:43 PM, Jack Krupansky <jack@basetechnology.com>
wrote:

> Indexing and query of raw JSON would be a valuable addition to Solr, so
> maybe you could simply explain more precisely your data model and
> transformation rules. For example, when multi-level nesting occurs, what
> does your loader do?
>
> Maybe if the fielld names were derived by concatenating the full path of
> JSON key names, like titles_json.FR, field_naming nesting could be handled
> in a fully automated manner.
>
> I had been thinking of filing a Jira proposing exactly that, so that even
> the most deeply nested JSON maps could be supported, although combinations
> of arrays and maps would be problematic.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Michael Pitsounis
> Sent: Wednesday, August 20, 2014 7:14 PM
> To: solr-user@lucene.apache.org
> Subject: embedded documents
>
> Hello everybody,
>
> I had a requirement to store complicated json documents in solr.
>
> i have modified the JsonLoader to accept complicated json documents with
> arrays/objects as values.
>
> It stores the object/array and then flatten it and  indexes the fields.
>
> e.g  basic example document
>
>  {
>        "titles_json":{"FR":"This is the FR title" , "EN":"This is the EN
> title"} ,
>        "id": 1000003,
>        "guid": "3b2f2998-85ac-4a4e-8867-beb551c0b3c6"
>   }
>
> It will store titles_json:{"FR":"This is the FR title" , "EN":"This is the
> EN title"}
> and then index fields
>
> titles.FR:"This is the FR title"
> titles.EN:"This is the EN title"
>
>
> Do you see any problems with this approach?
>
>
>
> Regards,
> Michael Pitsounis
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message