Search in sources :

Example 1 with OIndexManager

use of com.orientechnologies.orient.core.index.OIndexManager in project wicket-orientdb by OrienteerBAP.

the class OIndexModel method loadInstance.

@Override
protected OIndex<?> loadInstance() {
    OClass oClass = classModel != null ? classModel.getObject() : null;
    OIndexManager indexManager = OrientDbWebSession.get().getDatabase().getMetadata().getIndexManager();
    return oClass != null ? indexManager.getClassIndex(oClass.getName(), indexName) : indexManager.getIndex(indexName);
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OClass(com.orientechnologies.orient.core.metadata.schema.OClass)

Example 2 with OIndexManager

use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.

the class IndexManagerTest method testAreIndexedThreePropertiesBrokenFiledNameCase.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testAreIndexedThreePropertiesBrokenFiledNameCase() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final boolean result = indexManager.areIndexed(CLASS_NAME, Arrays.asList("ftwO", "Fone", "fThrEE"));
    assertTrue(result);
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) Test(org.testng.annotations.Test)

Example 3 with OIndexManager

use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.

the class IndexManagerTest method testAreIndexedOneProperty.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testAreIndexedOneProperty() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final boolean result = indexManager.areIndexed(CLASS_NAME, Arrays.asList("fOne"));
    assertTrue(result);
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) Test(org.testng.annotations.Test)

Example 4 with OIndexManager

use of com.orientechnologies.orient.core.index.OIndexManager 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"));
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OSimpleKeyIndexDefinition(com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition) Test(org.testng.annotations.Test)

Example 5 with OIndexManager

use of com.orientechnologies.orient.core.index.OIndexManager in project orientdb by orientechnologies.

the class IndexManagerTest method testDropNullKeyDefinition.

@Test
public void testDropNullKeyDefinition() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    indexManager.createIndex("nullkeytwo", OClass.INDEX_TYPE.UNIQUE.toString(), null, null, null, null);
    assertNotNull(indexManager.getIndex("nullkeytwo"));
    indexManager.dropIndex("nullkeytwo");
    assertNull(indexManager.getIndex("nullkeytwo"));
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) Test(org.testng.annotations.Test)

Aggregations

OIndexManager (com.orientechnologies.orient.core.index.OIndexManager)46 Test (org.testng.annotations.Test)40 OIndex (com.orientechnologies.orient.core.index.OIndex)18 OPropertyIndexDefinition (com.orientechnologies.orient.core.index.OPropertyIndexDefinition)5 OCompositeIndexDefinition (com.orientechnologies.orient.core.index.OCompositeIndexDefinition)3 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)3 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)2 OIndexDefinition (com.orientechnologies.orient.core.index.OIndexDefinition)2 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)2 HashSet (java.util.HashSet)2 OException (com.orientechnologies.common.exception.OException)1 OCommandCacheSoftRefs (com.orientechnologies.orient.core.cache.OCommandCacheSoftRefs)1 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)1 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)1 ORecordOperation (com.orientechnologies.orient.core.db.record.ORecordOperation)1 OSecurityException (com.orientechnologies.orient.core.exception.OSecurityException)1 OTransactionException (com.orientechnologies.orient.core.exception.OTransactionException)1 ORID (com.orientechnologies.orient.core.id.ORID)1 ORecordId (com.orientechnologies.orient.core.id.ORecordId)1 OIndexKeyCursor (com.orientechnologies.orient.core.index.OIndexKeyCursor)1