SOLR-6471

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1622773 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2014-09-05 19:44:45 +00:00
parent 5af7459462
commit 6386f1760f
3 changed files with 24 additions and 22 deletions

View File

@ -77,28 +77,27 @@ public class UpdateRequestHandler extends ContentStreamHandlerBase {
public void load(SolrQueryRequest req, SolrQueryResponse rsp, public void load(SolrQueryRequest req, SolrQueryResponse rsp,
ContentStream stream, UpdateRequestProcessor processor) throws Exception { ContentStream stream, UpdateRequestProcessor processor) throws Exception {
ContentStreamLoader ldr = pathVsLoaders.get(req.getContext().get("path")); ContentStreamLoader loader = pathVsLoaders.get(req.getContext().get("path"));
if(ldr != null){ log.info("$$$$$$$ used the pathVsLoaders {} ",req.getContext().get("path"));
ldr.load(req,rsp,stream,processor); if(loader == null) {
return; 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) { if(loader.getDefaultWT()!=null) {
setDefaultWT(req,loader); setDefaultWT(req,loader);
} }

View File

@ -191,7 +191,7 @@ public class JsonLoader extends ContentStreamLoader {
private void handleSplitMode(String split, String[] fields) throws IOException { private void handleSplitMode(String split, String[] fields) throws IOException {
if(split == null) split = "/"; 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")); final boolean echo = "true".equals( req.getParams().get("echo"));
JsonRecordReader jsonRecordReader = JsonRecordReader.getInst(split, Arrays.asList(fields)); JsonRecordReader jsonRecordReader = JsonRecordReader.getInst(split, Arrays.asList(fields));
jsonRecordReader.streamRecords(parser,new JsonRecordReader.Handler() { jsonRecordReader.streamRecords(parser,new JsonRecordReader.Handler() {

View File

@ -1038,7 +1038,10 @@
</analyzer> </analyzer>
</fieldType> </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. <!-- Similarity is the scoring routine for each document vs. a query.
A custom Similarity or SimilarityFactory may be specified here, but A custom Similarity or SimilarityFactory may be specified here, but
the default is fine for most applications. the default is fine for most applications.