Example usage for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy getDistErrPct

List of usage examples for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy getDistErrPct

Introduction

In this page you can find the example usage for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy getDistErrPct.

Prototype

public double getDistErrPct() 

Source Link

Usage

From source file:org.openspaces.spatial.LuceneConfigurationTest.java

License:Open Source License

@Test
public void testStrategyRecursivePrefixTreeAndDistErrPct() {
    LuceneSpatialQueryExtensionProvider provider = new LuceneSpatialQueryExtensionProvider()
            .setCustomProperty("lucene.strategy", "RecursivePrefixTree")
            .setCustomProperty("lucene.strategy.spatial-prefix-tree", "GeohashPrefixTree")
            .setCustomProperty("lucene.strategy.spatial-prefix-tree.max-levels", "10")
            .setCustomProperty("lucene.strategy.distance-error-pct", "0.5");
    QueryExtensionRuntimeInfo config = new MockConfig().setWorkDir(getWorkingDir());

    LuceneSpatialConfiguration luceneConfiguration = new LuceneSpatialConfiguration(provider, config);

    Assert.assertEquals("Unexpected strategy type", RecursivePrefixTreeStrategy.class,
            luceneConfiguration.getStrategy("myField").getClass());
    RecursivePrefixTreeStrategy strategy = (RecursivePrefixTreeStrategy) luceneConfiguration
            .getStrategy("myField");
    Assert.assertEquals("Unexpected spatial prefix tree", GeohashPrefixTree.class,
            strategy.getGrid().getClass());
    Assert.assertEquals("MaxLevels should be 10", 10, strategy.getGrid().getMaxLevels());
    Assert.assertTrue("Expecting distance-error-pct to be 0.5", 0.5 == strategy.getDistErrPct());
}