我正在尝试向数据库中的关系添加索引,但是不知道这对吗?
ListParameterization spatparams = new ListParameterization();
spatparams.addParameter(INDEX_ID, RStarTreeFactory.class);
spatparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 300);
spatparams.addParameter(AbstractRStarTreeFactory.Parameterizer.INSERTION_STRATEGY_ID, ApproximativeLeastOverlapInsertionStrategy.class);
spatparams.addParameter(ApproximativeLeastOverlapInsertionStrategy.Parameterizer.INSERTION_CANDIDATES_ID, 1);
//适配器以从现有阵列加载数据。
DatabaseConnection dbc = new ArrayAdapterDatabaseConnection(data);
//创建一个数据库(其中可能包含多个关系!)
Collection<IndexFactory<?, ?>> indexFactories = new ArrayList<>();
ObjectListParameter<IndexFactory<?, ?>> indexFactoryP = new ObjectListParameter<>(INDEX_ID, IndexFactory.class, true);
indexFactories.addAll(indexFactoryP.instantiateClasses(spatparams));
Database db = new StaticArrayDatabase(dbc, indexFactories);
db.initialize();
最佳答案
要通过参数化API实例化类,无需创建新参数。
RStarTreeFactory<DoubleVector> f =
ClassGenericsUtil.parameterizeOrAbort(RStarTreeFactory.class, params);
对于R-star树,我建议使用SortTileRecursive批量加载。