@Override
public OIndexInternal<?> createIndex(String name, OStorage storage, String indexType, String algorithm,
String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException {
OAbstractPaginatedStorage pagStorage = (OAbstractPaginatedStorage) storage.getUnderlying();
OBinarySerializer<?> objectSerializer = storage.getComponentsFactory().binarySerializerFactory
.getObjectSerializer(OLuceneMockSpatialSerializer.INSTANCE.getId());
if (objectSerializer == null) {
storage.getComponentsFactory().binarySerializerFactory
.registerSerializer(OLuceneMockSpatialSerializer.INSTANCE, OType.EMBEDDED);
}
if (metadata == null)
metadata = new ODocument().field("analyzer", StandardAnalyzer.class.getName());
if (OClass.INDEX_TYPE.SPATIAL.toString().equals(indexType)) {
final int binaryFormatVersion = pagStorage.getConfiguration().getBinaryFormatVersion();
return new OLuceneSpatialIndex(name, indexType, LUCENE_ALGORITHM, version, pagStorage, valueContainerAlgorithm, metadata,
binaryFormatVersion);
}
throw new OConfigurationException("Unsupported type : " + algorithm);
}