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

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

Introduction

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

Prototype

String DIST_ERR_PCT

To view the source code for org.apache.lucene.spatial.query SpatialArgsParser DIST_ERR_PCT.

Click Source Link

Usage

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

License:Apache License

@Override
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<String, String>(args);
    grid = SpatialPrefixTreeFactory.makeSPT(argsWrap, schema.getResourceLoader().getClassLoader(), ctx);
    args.keySet().removeAll(argsWrap.getSeenKeys());

    String v = args.remove(SpatialArgsParser.DIST_ERR_PCT);
    if (v != null)
        distErrPct = Double.valueOf(v);

    v = args.remove(DEFAULT_FIELD_VALUES_ARRAY_LEN);
    if (v != null)
        defaultFieldValuesArrayLen = Integer.valueOf(v);
}

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

License:Apache License

@Override
protected void init(IndexSchema schema, Map<String, String> args) {
    Map<String, String> origArgs = new HashMap<>(args); // clone so we can feed it to an aggregated field type
    super.init(schema, origArgs);

    //TODO Move this check to a call from AbstractSpatialFieldType.createFields() so the type can declare
    // if it supports multi-valued or not. It's insufficient here; we can't see if you set multiValued on the field.
    if (isMultiValued()) {
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                "Not capable of multiValued: " + getTypeName());
    }//from   ww w  .  j a  v  a  2s .  c o m

    // Choose a better default distErrPct if not configured
    if (args.containsKey(SpatialArgsParser.DIST_ERR_PCT) == false) {
        args.put(SpatialArgsParser.DIST_ERR_PCT, DEFAULT_DIST_ERR_PCT);
    }

    rptFieldType = new SpatialRecursivePrefixTreeFieldType();
    rptFieldType.setTypeName(getTypeName());
    rptFieldType.properties = properties;
    rptFieldType.init(schema, args);

    rptFieldType.argsParser = argsParser = newSpatialArgsParser();
    this.ctx = rptFieldType.ctx;
    this.distanceUnits = rptFieldType.distanceUnits;
}