mirror of https://github.com/apache/lucene.git
SOLR-6633 field name changed from _src to _src_ by populafr demand
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1644100 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a102c548a
commit
5929d5b436
|
@ -277,7 +277,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
" \"f1\": \"v2\",\n" +
|
" \"f1\": \"v2\",\n" +
|
||||||
" \"f2\": null\n" +
|
" \"f2\": null\n" +
|
||||||
" }\n";
|
" }\n";
|
||||||
SolrQueryRequest req = req("srcField","_src");
|
SolrQueryRequest req = req("srcField","_src_");
|
||||||
req.getContext().put("path","/update/json/docs");
|
req.getContext().put("path","/update/json/docs");
|
||||||
SolrQueryResponse rsp = new SolrQueryResponse();
|
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||||
BufferingRequestProcessor p = new BufferingRequestProcessor(null);
|
BufferingRequestProcessor p = new BufferingRequestProcessor(null);
|
||||||
|
@ -304,7 +304,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
" \"f2\": \"v2\",\n" +
|
" \"f2\": \"v2\",\n" +
|
||||||
" \"f3\": null\n" +
|
" \"f3\": null\n" +
|
||||||
" }\n";
|
" }\n";
|
||||||
req = req("srcField","_src");
|
req = req("srcField","_src_");
|
||||||
req.getContext().put("path","/update/json/docs");
|
req.getContext().put("path","/update/json/docs");
|
||||||
rsp = new SolrQueryResponse();
|
rsp = new SolrQueryResponse();
|
||||||
p = new BufferingRequestProcessor(null);
|
p = new BufferingRequestProcessor(null);
|
||||||
|
@ -313,7 +313,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
assertEquals( 2, p.addCommands.size() );
|
assertEquals( 2, p.addCommands.size() );
|
||||||
|
|
||||||
String content = (String) p.addCommands.get(0).solrDoc.getFieldValue("_src");
|
String content = (String) p.addCommands.get(0).solrDoc.getFieldValue("_src_");
|
||||||
assertNotNull(content);
|
assertNotNull(content);
|
||||||
Map obj = (Map) ObjectBuilder.fromJSON(content);
|
Map obj = (Map) ObjectBuilder.fromJSON(content);
|
||||||
assertEquals(Boolean.TRUE, obj.get("bool"));
|
assertEquals(Boolean.TRUE, obj.get("bool"));
|
||||||
|
@ -322,7 +322,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
assertNotNull(obj.get("array"));
|
assertNotNull(obj.get("array"));
|
||||||
assertNotNull(obj.get("boosted"));
|
assertNotNull(obj.get("boosted"));
|
||||||
|
|
||||||
content = (String) p.addCommands.get(1).solrDoc.getFieldValue("_src");
|
content = (String) p.addCommands.get(1).solrDoc.getFieldValue("_src_");
|
||||||
assertNotNull(content);
|
assertNotNull(content);
|
||||||
obj = (Map) ObjectBuilder.fromJSON(content);
|
obj = (Map) ObjectBuilder.fromJSON(content);
|
||||||
assertEquals("v1", obj.get("f1"));
|
assertEquals("v1", obj.get("f1"));
|
||||||
|
@ -330,7 +330,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
assertTrue(obj.containsKey("f3"));
|
assertTrue(obj.containsKey("f3"));
|
||||||
|
|
||||||
doc = "[{'id':'1'},{'id':'2'}]".replace('\'', '"');
|
doc = "[{'id':'1'},{'id':'2'}]".replace('\'', '"');
|
||||||
req = req("srcField","_src");
|
req = req("srcField","_src_");
|
||||||
req.getContext().put("path","/update/json/docs");
|
req.getContext().put("path","/update/json/docs");
|
||||||
rsp = new SolrQueryResponse();
|
rsp = new SolrQueryResponse();
|
||||||
p = new BufferingRequestProcessor(null);
|
p = new BufferingRequestProcessor(null);
|
||||||
|
@ -338,11 +338,11 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
||||||
loader.load(req, rsp, new ContentStreamBase.StringStream(doc), p);
|
loader.load(req, rsp, new ContentStreamBase.StringStream(doc), p);
|
||||||
assertEquals( 2, p.addCommands.size() );
|
assertEquals( 2, p.addCommands.size() );
|
||||||
|
|
||||||
content = (String) p.addCommands.get(0).solrDoc.getFieldValue("_src");
|
content = (String) p.addCommands.get(0).solrDoc.getFieldValue("_src_");
|
||||||
assertNotNull(content);
|
assertNotNull(content);
|
||||||
obj = (Map) ObjectBuilder.fromJSON(content);
|
obj = (Map) ObjectBuilder.fromJSON(content);
|
||||||
assertEquals("1", obj.get("id"));
|
assertEquals("1", obj.get("id"));
|
||||||
content = (String) p.addCommands.get(1).solrDoc.getFieldValue("_src");
|
content = (String) p.addCommands.get(1).solrDoc.getFieldValue("_src_");
|
||||||
assertNotNull(content);
|
assertNotNull(content);
|
||||||
obj = (Map) ObjectBuilder.fromJSON(content);
|
obj = (Map) ObjectBuilder.fromJSON(content);
|
||||||
assertEquals("2", obj.get("id"));
|
assertEquals("2", obj.get("id"));
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
<field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
|
<field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
|
||||||
<field name="last_modified" type="date" indexed="true" stored="true"/>
|
<field name="last_modified" type="date" indexed="true" stored="true"/>
|
||||||
<field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
|
<field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
|
||||||
<field name="_src" type="string" indexed="false" stored="true"/>
|
<field name="_src_" type="string" indexed="false" stored="true"/>
|
||||||
|
|
||||||
<!-- Main body of document extracted by SolrCell.
|
<!-- Main body of document extracted by SolrCell.
|
||||||
NOTE: This field is not indexed by default, since it is also copied to "text"
|
NOTE: This field is not indexed by default, since it is also copied to "text"
|
||||||
|
|
|
@ -1054,7 +1054,7 @@
|
||||||
<initParams path="/update/json/docs">
|
<initParams path="/update/json/docs">
|
||||||
<lst name="defaults">
|
<lst name="defaults">
|
||||||
<!--this ensures that the entire json doc will be stored verbatim into one field-->
|
<!--this ensures that the entire json doc will be stored verbatim into one field-->
|
||||||
<str name="srcField">_src</str>
|
<str name="srcField">_src_</str>
|
||||||
<!--This means a the uniqueKeyField will be extracted from the fields and
|
<!--This means a the uniqueKeyField will be extracted from the fields and
|
||||||
all fields go into the 'df' field. In this config df is already configured to be 'text'
|
all fields go into the 'df' field. In this config df is already configured to be 'text'
|
||||||
-->
|
-->
|
||||||
|
|
Loading…
Reference in New Issue