org.apache.lucene.spatial.prefix.PrefixTreeStrategy Java Examples

The following examples show how to use org.apache.lucene.spatial.prefix.PrefixTreeStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSpatialPrefixTreeFieldType.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * This analyzer is not actually used for indexing.  It is implemented here
 * so that the analysis UI will show reasonable tokens.
 */
@Override
public Analyzer getIndexAnalyzer() {
  return new Analyzer() {
    @Override
    protected TokenStreamComponents createComponents(String fieldName) {
      PrefixTreeStrategy s = newSpatialStrategy(fieldName == null ? getTypeName() : fieldName);
      PrefixTreeStrategy.ShapeTokenStream ts = s.tokenStream();
      return new TokenStreamComponents(r -> {
        try {
          ts.setShape(parseShape(IOUtils.toString(r)));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }, ts);
    }
  };
}
 
Example #2
Source File: GeoShapeFieldMapper.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public PrefixTreeStrategy resolveStrategy(String strategyName) {
    if (SpatialStrategy.RECURSIVE.getStrategyName().equals(strategyName)) {
        return recursiveStrategy;
    }
    if (SpatialStrategy.TERM.getStrategyName().equals(strategyName)) {
        return termStrategy;
    }
    throw new IllegalArgumentException("Unknown prefix tree strategy [" + strategyName + "]");
}
 
Example #3
Source File: FacetHeatmap.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
FacetHeatmap(Map<String, Object> argsMap, PrefixTreeStrategy strategy, Shape boundsShape, int gridLevel, int maxCells, String format) {
  this.argsMap = argsMap;
  this.strategy = strategy;
  this.boundsShape = boundsShape;
  this.gridLevel = gridLevel;
  this.maxCells = maxCells;
  this.format = format;
}
 
Example #4
Source File: GeoShapeFieldMapper.java    From crate with Apache License 2.0 5 votes vote down vote up
public PrefixTreeStrategy resolveStrategy(String strategyName) {
    if (SpatialStrategy.RECURSIVE.getStrategyName().equals(strategyName)) {
        return recursiveStrategy;
    }
    if (SpatialStrategy.TERM.getStrategyName().equals(strategyName)) {
        return termStrategy;
    }
    throw new IllegalArgumentException("Unknown prefix tree strategy [" + strategyName + "]");
}
 
Example #5
Source File: GeoShapeFieldMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public PrefixTreeStrategy defaultStrategy() {
    return this.defaultStrategy;
}
 
Example #6
Source File: GeoShapeFieldMapper.java    From crate with Apache License 2.0 4 votes vote down vote up
public PrefixTreeStrategy defaultStrategy() {
    return this.defaultStrategy;
}
 
Example #7
Source File: GeoShapeFieldMapper.java    From crate with Apache License 2.0 4 votes vote down vote up
public PrefixTreeStrategy resolveStrategy(SpatialStrategy strategy) {
    return resolveStrategy(strategy.getStrategyName());
}