Apache Solr open-source search software
SOLR-6471
Noble Paul6386f1760feb
diff --git a/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.javaindex 4caaea2169a..4519a2a25ab 100644--- a/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java@@ -77,28 +77,27 @@ public class UpdateRequestHandler extends ContentStreamHandlerBase {public void load(SolrQueryRequest req, SolrQueryResponse rsp,ContentStream stream, UpdateRequestProcessor processor) throws Exception {- ContentStreamLoader ldr = pathVsLoaders.get(req.getContext().get("path"));- if(ldr != null){- ldr.load(req,rsp,stream,processor);- return;+ ContentStreamLoader loader = pathVsLoaders.get(req.getContext().get("path"));+ log.info("$$$$$$$ used the pathVsLoaders {} ",req.getContext().get("path"));+ if(loader == null) {+ String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);+ if (type == null) {+ type = stream.getContentType();+ }+ if (type == null) { // Normal requests will not get here.+ throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Missing ContentType");+ }+ int idx = type.indexOf(';');+ if (idx > 0) {+ type = type.substring(0, idx);+ }+ loader = loaders.get(type);+ if (loader == null) {+ throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Unsupported ContentType: "+ + type + " Not in: " + loaders.keySet());+ }}- String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);- if(type == null) {- type = stream.getContentType();- }- if( type == null ) { // Normal requests will not get here.- throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Missing ContentType");- }- int idx = type.indexOf(';');- if(idx>0) {- type = type.substring(0,idx);- }- ContentStreamLoader loader = loaders.get(type);- if(loader==null) {- throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Unsupported ContentType: "- +type+ " Not in: "+loaders.keySet());- }if(loader.getDefaultWT()!=null) {setDefaultWT(req,loader);}diff --git a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.javaindex 5e428ef1ab2..177fe1afb2b 100644--- a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java+++ b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java@@ -191,7 +191,7 @@ public class JsonLoader extends ContentStreamLoader {private void handleSplitMode(String split, String[] fields) throws IOException {if(split == null) split = "/";- if(fields == null || fields.length ==0) fields = new String[]{"/*"};+ if(fields == null || fields.length ==0) fields = new String[]{"/**"};final boolean echo = "true".equals( req.getParams().get("echo"));JsonRecordReader jsonRecordReader = JsonRecordReader.getInst(split, Arrays.asList(fields));jsonRecordReader.streamRecords(parser,new JsonRecordReader.Handler() {diff --git a/solr/example/example-schemaless/solr/collection1/conf/schema.xml b/solr/example/example-schemaless/solr/collection1/conf/schema.xmlindex 88cc79bdddf..432c735b896 100755--- a/solr/example/example-schemaless/solr/collection1/conf/schema.xml+++ b/solr/example/example-schemaless/solr/collection1/conf/schema.xml@@ -1038,7 +1038,10 @@</analyzer></fieldType>-+ <!-- catchall field, containing all other searchable text fields (implemented+ via copyField) -->+ <field name="_text" type="text_general" indexed="true" stored="false" multiValued="true"/>+ <copyField source="*" dest="_text"/><!-- Similarity is the scoring routine for each document vs. a query.A custom Similarity or SimilarityFactory may be specified here, butthe default is fine for most applications.