Example usage for org.apache.solr.schema AbstractSpatialFieldType getStrategy

List of usage examples for org.apache.solr.schema AbstractSpatialFieldType getStrategy

Introduction

In this page you can find the example usage for org.apache.solr.schema AbstractSpatialFieldType getStrategy.

Prototype

public T getStrategy(final String fieldName) 

Source Link

Document

Gets the cached strategy for this field, creating it if necessary via #newSpatialStrategy(String) .

Usage

From source file:com.gogobot.DistanceParser.java

License:Apache License

private MultiValueSource parseSfield(FunctionQParser fp) throws SyntaxError {
    String sfield = fp.getParam(SpatialParams.FIELD);
    if (sfield == null)
        return null;
    SchemaField sf = fp.getReq().getSchema().getField(sfield);
    FieldType type = sf.getType();//from w ww .  j  ava 2 s. c  o  m
    if (type instanceof AbstractSpatialFieldType) {
        AbstractSpatialFieldType asft = (AbstractSpatialFieldType) type;
        return new SpatialStrategyMultiValueSource(asft.getStrategy(sfield));
    }
    ValueSource vs = type.getValueSource(sf, fp);
    if (vs instanceof MultiValueSource) {
        return (MultiValueSource) vs;
    }
    throw new SyntaxError(
            "Spatial field must implement MultiValueSource or extend AbstractSpatialFieldType:" + sf);
}