I view “flattening” as moving from a highly functional format (JSON) to a less
functional format (flat, text-like).
Many of the less functional formats we see, that do not permit hierarchical
Maps, nevertheless permit List<String> and List<Number>. (No, not List<Map>,
obviously.)
A typical, and workable, flattening would be comma-separated substrings (the
below illustrates a possible escape):
"list": ["e1", "e2,foo", "e3"]
->
list: "e1,e2\,foo,e3" or " e1,e2,foo,e3"
A list of numbers, with period decimal mark, also does well as a
comma-separated string.
I would suggest that only List<String> and List<Number> be flattened this way.
This allows us to express the kind of formats that are typical in flat
configuration parameter files used by many other systems.
List<Object> could be reasonably flattened with dotted indexes, as you suggest,
or left for a later implementation.
--Matt
On 2/24/17, 7:34 AM, "Nick Allen" <[email protected]> wrote:
And sorry this should be...
"list": ["e1", "e2", "e3"]
->
list.0: e1
list.1: e2
list.2: e3
On Fri, Feb 24, 2017 at 10:26 AM, Nick Allen <[email protected]> wrote:
> So I don't need to unfold lists, but I do maps? I thought the commentary
> on METRON-686 was that Solr cannot handle "complex types". I took that to
> mean both maps and lists.
>
> Yes, Otto. The only reasonable way to unfold a list would be using the
> index of the element.
>
> "list": ["e1", "e2", "e3"]
> ->
> list.0.e1
> list.1.e2
> list.2.e3
>
>
> I don't want to unfold lists or maps. :)
>
>
>
>
> On Fri, Feb 24, 2017 at 10:17 AM, Otto Fowler <[email protected]>
> wrote:
>
>> No, I don’t think it does. I am not sure how you would do that, other
>> than putting a number at the end of the unwrapped array item?
>>
>>
>>
>> On February 24, 2017 at 10:12:26, Nick Allen ([email protected]) wrote:
>>
>> Per Otto's advice, I am looking to reuse the normalizer/flattener
>> mechanism
>> that currently exists in JSONMapParser. It looks like the mechanism is
>> built into the class, so I will have to extract it. It looks like landing
>> it in JSONUtils is a logical place.
>>
>> It appears that the mechanism only handles maps, not lists. Is that true?
>> I will need to add similar functionality for lists to reuse this for
>> METRON-686.
>>
>>
>