LUCENE-8126: Add "s2" to SpatialPrefixTreeFactory lookup table

This commit is contained in:
David Smiley 2018-03-05 10:52:02 -05:00
parent d789516836
commit e0d6465af9
1 changed files with 3 additions and 0 deletions

View File

@ -43,6 +43,7 @@ public abstract class SpatialPrefixTreeFactory {
* If it's neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen. * If it's neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
*/ */
public static SpatialPrefixTree makeSPT(Map<String,String> args, ClassLoader classLoader, SpatialContext ctx) { public static SpatialPrefixTree makeSPT(Map<String,String> args, ClassLoader classLoader, SpatialContext ctx) {
//TODO refactor to use Java SPI like how Lucene already does for codecs/postingsFormats, etc
SpatialPrefixTreeFactory instance; SpatialPrefixTreeFactory instance;
String cname = args.get(PREFIX_TREE); String cname = args.get(PREFIX_TREE);
if (cname == null) if (cname == null)
@ -53,6 +54,8 @@ public abstract class SpatialPrefixTreeFactory {
instance = new QuadPrefixTree.Factory(); instance = new QuadPrefixTree.Factory();
else if ("packedQuad".equalsIgnoreCase(cname)) else if ("packedQuad".equalsIgnoreCase(cname))
instance = new PackedQuadPrefixTree.Factory(); instance = new PackedQuadPrefixTree.Factory();
else if ("s2".equalsIgnoreCase(cname))
instance = new S2PrefixTree.Factory();
else { else {
try { try {
Class<?> c = classLoader.loadClass(cname); Class<?> c = classLoader.loadClass(cname);