mirror of https://github.com/apache/lucene.git
SOLR-6706
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1636900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ba0c5980fe
commit
d32a68961b
|
@ -394,6 +394,7 @@ public class JsonRecordReader {
|
|||
event = parser.nextEvent();
|
||||
if (event == STRING ||
|
||||
event == LONG ||
|
||||
event == NUMBER ||
|
||||
event == BIGNUMBER ||
|
||||
event == BOOLEAN ||
|
||||
event == NULL) {
|
||||
|
|
|
@ -203,4 +203,24 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 {
|
|||
|
||||
}
|
||||
|
||||
public void testNestedJsonWithFloats() throws Exception {
|
||||
|
||||
String json = "{\n" +
|
||||
" \"a_string\" : \"abc\",\n" +
|
||||
" \"a_num\" : 2.0,\n" +
|
||||
" \"a\" : {\n" +
|
||||
" \"b\" : [\n" +
|
||||
" {\"id\":\"1\", \"title\" : \"test1\"},\n" +
|
||||
" {\"id\":\"2\", \"title\" : \"test2\"}\n" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
JsonRecordReader streamer;
|
||||
List<Map<String, Object>> records;
|
||||
|
||||
streamer = JsonRecordReader.getInst("/a/b", Collections.singletonList("title_s:/a/b/title"));
|
||||
records = streamer.getAllRecords(new StringReader(json));
|
||||
assertEquals(2, records.size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue