Merged revision(s) 1672531 from lucene/dev/branches/branch_5x:

SOLR-7373: let AbstractSpatialFieldType set the context
........



git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1672533 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2015-04-10 03:38:22 +00:00
parent 6bed01b2ae
commit a2d29b8e12
1 changed files with 7 additions and 5 deletions

View File

@ -113,11 +113,13 @@ public abstract class AbstractSpatialFieldType<T extends SpatialStrategy> extend
protected void init(IndexSchema schema, Map<String, String> args) {
super.init(schema, args);
//Solr expects us to remove the parameters we've used.
MapListener<String, String> argsWrap = new MapListener<>(args);
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
args.keySet().removeAll(argsWrap.getSeenKeys());
if(ctx==null) { // subclass can set this directly
//Solr expects us to remove the parameters we've used.
MapListener<String, String> argsWrap = new MapListener<>(args);
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
args.keySet().removeAll(argsWrap.getSeenKeys());
}
final String unitsErrMsg = "units parameter is deprecated, please use distanceUnits instead for field types with class " +
getClass().getSimpleName();
this.units = args.remove("units");//deprecated