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:
Noble Paul 2014-11-05 15:41:08 +00:00
parent ba0c5980fe
commit d32a68961b
2 changed files with 22 additions and 1 deletions

View File

@ -394,6 +394,7 @@ public class JsonRecordReader {
event = parser.nextEvent();
if (event == STRING ||
event == LONG ||
event == NUMBER ||
event == BIGNUMBER ||
event == BOOLEAN ||
event == NULL) {

View File

@ -180,7 +180,7 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 {
records = streamer.getAllRecords(new StringReader(json));
assertEquals(2, records.size());
for (Map<String, Object> record : records) {
assertEquals(6,record.size());
assertEquals(6, record.size());
assertTrue(record.containsKey("subject"));
assertTrue(record.containsKey("test"));
assertTrue(record.containsKey("marks"));
@ -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());
}
}