Example usage for org.apache.lucene.spatial.query SpatialArgsParser SpatialArgsParser

List of usage examples for org.apache.lucene.spatial.query SpatialArgsParser SpatialArgsParser

Introduction

In this page you can find the example usage for org.apache.lucene.spatial.query SpatialArgsParser SpatialArgsParser.

Prototype

SpatialArgsParser

Source Link

Usage

From source file:org.apache.solr.schema.AbstractSpatialFieldType.java

License:Apache License

@Override
protected void init(IndexSchema schema, Map<String, String> args) {
    super.init(schema, args);

    String units = args.remove("units");
    if (!"degrees".equals(units))
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                "Must specify units=\"degrees\" on field types with class " + getClass().getSimpleName());

    //Solr expects us to remove the parameters we've used.
    MapListener<String, String> argsWrap = new MapListener<String, String>(args);
    ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
    args.keySet().removeAll(argsWrap.getSeenKeys());

    argsParser = new SpatialArgsParser();//might make pluggable some day?
}