Java Code Examples for org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy#setPrefixGridScanLevel()
The following examples show how to use
org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy#setPrefixGridScanLevel() .
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: SpatialDocMaker.java From lucene-solr with Apache License 2.0 | 6 votes |
protected RecursivePrefixTreeStrategy makeRPTStrategy(String spatialField, Config config, Map<String, String> configMap, SpatialContext ctx) { //A factory for the prefix tree grid SpatialPrefixTree grid = SpatialPrefixTreeFactory.makeSPT(configMap, null, ctx); RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, spatialField); strategy.setPointsOnly(config.get("spatial.docPointsOnly", false)); final boolean pruneLeafyBranches = config.get("spatial.pruneLeafyBranches", true); if (grid instanceof PackedQuadPrefixTree) { ((PackedQuadPrefixTree) grid).setPruneLeafyBranches(pruneLeafyBranches); strategy.setPruneLeafyBranches(false);//always leave it to packed grid, even though it isn't the same } else { strategy.setPruneLeafyBranches(pruneLeafyBranches); } int prefixGridScanLevel = config.get("query.spatial.prefixGridScanLevel", -4); if (prefixGridScanLevel < 0) prefixGridScanLevel = grid.getMaxLevels() + prefixGridScanLevel; strategy.setPrefixGridScanLevel(prefixGridScanLevel); double distErrPct = config.get("spatial.distErrPct", .025);//doc & query; a default strategy.setDistErrPct(distErrPct); return strategy; }
Example 2
Source File: SpatialRecursivePrefixTreeFieldType.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override protected RecursivePrefixTreeStrategy newPrefixTreeStrategy(String fieldName) { RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, fieldName); if (prefixGridScanLevel != null) strategy.setPrefixGridScanLevel(prefixGridScanLevel); if (grid instanceof PackedQuadPrefixTree) { // This grid has a (usually) better prune leafy branch implementation ((PackedQuadPrefixTree) grid).setPruneLeafyBranches(true); strategy.setPruneLeafyBranches(false); } return strategy; }