[
https://issues.apache.org/jira/browse/SOLR-12094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400902#comment-16400902
]
Dawid Weiss commented on SOLR-12094:
------------------------------------
There is something I don't understand. In your patch this node is outside of
the {{/exams}} path:
{code}
public void testRecursiveWildcard2() throws Exception {
String json = "{\n" +
" \"first\": \"John\",\n" +
" \"last\": \"Doe\",\n" +
" \"grade\": 8,\n" +
" \"exams\": [\n" +
" {\n" +
" \"subject\": \"Maths\",\n" +
" \"test\" : \"term1\",\n" +
" \"marks\":90},\n" +
" {\n" +
" \"subject\": \"Biology\",\n" +
" \"test\" : \"term1\",\n" +
" \"marks\":86}\n" +
" ],\n" +
" \"after\": \"456\"\n" +
"}";
JsonRecordReader streamer;
List<Map<String, Object>> records;
streamer = JsonRecordReader.getInst("/exams",
Collections.singletonList("/**"));
records = streamer.getAllRecords(new StringReader(json));
assertEquals(2, records.size());
for (Map<String, Object> record : records) {
assertEquals(7, record.size());
assertTrue(record.containsKey("subject"));
assertTrue(record.containsKey("test"));
assertTrue(record.containsKey("marks"));
assertTrue(record.containsKey("first"));
assertTrue(record.containsKey("last"));
assertTrue(record.containsKey("grade"));
assertTrue(record.containsKey("after"));
}
{code}
So it fails for a reason -- {{after}} shouldn't be there and that's the correct
behavior?
> JsonRecordReader ignores root fields after split
> ------------------------------------------------
>
> Key: SOLR-12094
> URL: https://issues.apache.org/jira/browse/SOLR-12094
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: SolrJ
> Affects Versions: master (8.0)
> Reporter: Przemysław Szeremiota
> Priority: Major
> Attachments: json-record-reader-bug.patch
>
>
> JsonRecordReader, when configured with other than top-level split, ignores
> all top-level JSON nodes after split ends, for example:
> {code}
> {
> "first": "John",
> "last": "Doe",
> "grade": 8,
> "exams": [
> {
> "subject": "Maths",
> "test": "term1",
> "marks": 90
> },
> {
> "subject": "Biology",
> "test": "term1",
> "marks": 86
> }
> ],
> "after": "456"
> }
> {code}
> Node "after" won't be visible in SolrInputDocument constructed from
> /update/json/docs.
> I don't have fix, only (breaking) patch for relevant test
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]