Example usage for org.apache.lucene.spatial.prefix.tree SpatialPrefixTreeFactory makeSPT

List of usage examples for org.apache.lucene.spatial.prefix.tree SpatialPrefixTreeFactory makeSPT

Introduction

In this page you can find the example usage for org.apache.lucene.spatial.prefix.tree SpatialPrefixTreeFactory makeSPT.

Prototype

public static SpatialPrefixTree makeSPT(Map<String, String> args, ClassLoader classLoader, SpatialContext ctx) 

Source Link

Document

The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".

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.eclipse.rdf4j.sail.lucene.LuceneIndex.java

License:Open Source License

protected Function<String, ? extends SpatialStrategy> createSpatialStrategyMapper(
        Map<String, String> parameters) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    SpatialContext geoContext = SpatialContextFactory.makeSpatialContext(parameters, classLoader);
    final SpatialPrefixTree spt = SpatialPrefixTreeFactory.makeSPT(parameters, classLoader, geoContext);
    return new Function<String, SpatialStrategy>() {

        @Override/*from  www  .j  av a 2  s  .  c o m*/
        public SpatialStrategy apply(String field) {
            return new RecursivePrefixTreeStrategy(spt, GEO_FIELD_PREFIX + field);
        }

    };
}

From source file:org.openrdf.sail.lucene4.LuceneIndex.java

License:BSD License

protected Function<String, ? extends SpatialStrategy> createSpatialStrategyMapper(
        Map<String, String> parameters) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    SpatialContext geoContext = SpatialContextFactory.makeSpatialContext(parameters, classLoader);
    final SpatialPrefixTree spt = SpatialPrefixTreeFactory.makeSPT(parameters, classLoader, geoContext);
    return new Function<String, SpatialStrategy>() {
        @Override// ww w .  j  a  v  a 2s.c o m
        public SpatialStrategy apply(String field) {
            return new RecursivePrefixTreeStrategy(spt, GEO_FIELD_PREFIX + field);
        }

    };
}