Search in sources :

Example 16 with OIndexManager

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

the class IndexManagerTest method testAreIndexedDoesNotContainProperty.

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

Example 17 with OIndexManager

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

the class IndexManagerTest method testGetClassInvolvedIndexesThreeProperties.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesThreeProperties() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, Arrays.asList("fTwo", "fOne", "fThree"));
    assertEquals(result.size(), 1);
    assertEquals(result.iterator().next().getName(), "compositetwo");
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Example 18 with OIndexManager

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

the class IndexManagerTest method testGetClassInvolvedIndexesOneProperty.

@Test(dependsOnMethods = { "createCompositeIndexTestWithListener", "createCompositeIndexTestWithoutListener", "testCreateOnePropertyIndexTest" })
public void testGetClassInvolvedIndexesOneProperty() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    final Set<OIndex<?>> result = indexManager.getClassInvolvedIndexes(CLASS_NAME, Arrays.asList("fOne"));
    assertEquals(result.size(), 3);
    assertTrue(containsIndex(result, "propertyone"));
    assertTrue(containsIndex(result, "compositeone"));
    assertTrue(containsIndex(result, "compositetwo"));
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) OIndex(com.orientechnologies.orient.core.index.OIndex) Test(org.testng.annotations.Test)

Example 19 with OIndexManager

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

the class IndexManagerTest method testDropNonExistingClassIndex.

@Test(dependsOnMethods = "testDropAllClassIndexes")
public void testDropNonExistingClassIndex() {
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    indexManager.dropIndex("twoclassproperty");
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) Test(org.testng.annotations.Test)

Example 20 with OIndexManager

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

the class OSchemaShared method dropClassIndexes.

private void dropClassIndexes(final OClass cls) {
    final ODatabaseDocument database = getDatabase();
    final OIndexManager indexManager = database.getMetadata().getIndexManager();
    for (final OIndex<?> index : indexManager.getClassIndexes(cls.getName())) indexManager.dropIndex(index.getName());
}
Also used : OIndexManager(com.orientechnologies.orient.core.index.OIndexManager) ODatabaseDocument(com.orientechnologies.orient.core.db.document.ODatabaseDocument)

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