use of com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition in project orientdb by orientechnologies.
the class IndexManagerTest method testDropSimpleKey.
@Test
public void testDropSimpleKey() {
final OIndexManager indexManager = database.getMetadata().getIndexManager();
indexManager.createIndex("simplekeytwo", OClass.INDEX_TYPE.UNIQUE.toString(), new OSimpleKeyIndexDefinition(-1, OType.INTEGER), null, null, null);
assertNotNull(indexManager.getIndex("simplekeytwo"));
indexManager.dropIndex("simplekeytwo");
assertNull(indexManager.getIndex("simplekeytwo"));
}
use of com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition in project orientdb by orientechnologies.
the class OrientIndex method create.
private void create(final String indexName, final Class<? extends Element> indexClass, OType iKeyType) {
this.indexClass = indexClass;
if (iKeyType == null)
iKeyType = OType.STRING;
final OIndexFactory factory = OIndexes.getFactory(OClass.INDEX_TYPE.DICTIONARY.toString(), null);
this.recordKeyValueIndex = new OIndexTxAwareOneValue(graph.getRawGraph(), (OIndex<OIdentifiable>) graph.getRawGraph().getMetadata().getIndexManager().createIndex("__@recordmap@___" + indexName, OClass.INDEX_TYPE.DICTIONARY.toString(), new OSimpleKeyIndexDefinition(factory.getLastVersion(), OType.LINK, OType.STRING), null, null, null));
final String className;
if (Vertex.class.isAssignableFrom(indexClass))
className = VERTEX;
else if (Edge.class.isAssignableFrom(indexClass))
className = EDGE;
else
className = indexClass.getName();
final ODocument metadata = new ODocument();
metadata.field(CONFIG_CLASSNAME, className);
metadata.field(CONFIG_RECORD_MAP_NAME, recordKeyValueIndex.getName());
final OIndexFactory nuFactory = OIndexes.getFactory(OClass.INDEX_TYPE.NOTUNIQUE.toString(), null);
// CREATE THE MAP
this.underlying = new OIndexTxAwareMultiValue(graph.getRawGraph(), (OIndex<Set<OIdentifiable>>) graph.getRawGraph().getMetadata().getIndexManager().createIndex(indexName, OClass.INDEX_TYPE.NOTUNIQUE.toString(), new OSimpleKeyIndexDefinition(nuFactory.getLastVersion(), iKeyType), null, null, metadata));
}
use of com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition in project orientdb by orientechnologies.
the class LuceneManualIndexTest method testManualIndexInsideTransaction.
@Test
public void testManualIndexInsideTransaction() throws Exception {
// refs https://github.com/orientechnologies/orientdb/issues/7255
OIndex<?> index = db.getMetadata().getIndexManager().createIndex("test", OClass.INDEX_TYPE.FULLTEXT.toString(), new OSimpleKeyIndexDefinition(1, OType.STRING), null, null, null, OLuceneIndexFactory.LUCENE_ALGORITHM);
db.begin();
ODocument document = db.newInstance();
document.field("name", "Rob");
db.save(document);
index.put("Rob", document.getIdentity());
index.flush();
List<ODocument> docs = db.command(new OSQLSynchQuery("select from index:test where key LUCENE 'k0:rob'")).execute();
Assert.assertEquals(docs.size(), 1);
db.commit();
}
use of com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition in project orientdb by orientechnologies.
the class MVRBTreeInsertionSpeedTest method init.
@Override
@Test(enabled = false)
public void init() throws Exception {
OGlobalConfiguration.NON_TX_CLUSTERS_SYNC_IMMEDIATELY.setValue("");
OGlobalConfiguration.INDEX_MANUAL_LAZY_UPDATES.setValue(10000);
String buildDirectory = System.getProperty("buildDirectory", ".");
if (buildDirectory == null)
buildDirectory = ".";
databaseDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDirectory + "/uniqueHashIndexTest");
if (databaseDocumentTx.exists()) {
databaseDocumentTx.open("admin", "admin");
databaseDocumentTx.drop();
}
databaseDocumentTx.create();
index = (OIndexUnique) databaseDocumentTx.getMetadata().getIndexManager().createIndex("mvrbtreeIndexTest", "UNIQUE", new OSimpleKeyIndexDefinition(-1, OType.STRING), new int[0], null, null);
}
use of com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition in project orientdb by orientechnologies.
the class HashIndexSpeedTest method init.
@Override
@Test(enabled = false)
public void init() throws Exception {
String buildDirectory = System.getProperty("buildDirectory", ".");
if (buildDirectory == null)
buildDirectory = ".";
databaseDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDirectory + "/uniqueHashIndexTest");
if (databaseDocumentTx.exists()) {
databaseDocumentTx.open("admin", "admin");
databaseDocumentTx.drop();
}
databaseDocumentTx.create();
hashIndex = databaseDocumentTx.getMetadata().getIndexManager().createIndex("hashIndex", "UNIQUE_HASH_INDEX", new OSimpleKeyIndexDefinition(-1, OType.STRING), new int[0], null, null);
}
Aggregations