GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChangeHandler,
        TypeDefChangeListener { private void rollback(AtlasGraphManagement management) throws IndexException { try { management.rollback(); recomputeIndexedKeys = true; } catch (Exception e) { LOG.error("Index rollback failed ", e); throw new IndexException("Index rollback failed ", e); } } @Inject  GraphBackedSearchIndexer(AtlasTypeRegistry typeRegistry); @VisibleForTesting  GraphBackedSearchIndexer( IAtlasGraphProvider provider, Configuration configuration, AtlasTypeRegistry typeRegistry); @Override void onAdd(Collection<? extends IDataType> dataTypes); @Override void onChange(Collection<? extends IDataType> dataTypes); Set<String> getVertexIndexKeys(); @Override void instanceIsActive(); @Override void instanceIsPassive(); @Override void onChange(ChangedTypeDefs changedTypeDefs);  }
@Test public void verifySystemMixedIndexes() { AtlasGraph graph = TestUtils.getGraph(); AtlasGraphManagement managementSystem = graph.getManagementSystem(); try { AtlasGraphIndex vertexIndex = managementSystem.getGraphIndex(Constants.VERTEX_INDEX); assertNotNull(vertexIndex); assertTrue(vertexIndex.isMixedIndex()); assertFalse(vertexIndex.isEdgeIndex()); assertTrue(vertexIndex.isVertexIndex()); AtlasGraphIndex edgeIndex = managementSystem.getGraphIndex(Constants.EDGE_INDEX); assertNotNull(edgeIndex); assertTrue(edgeIndex.isMixedIndex()); assertTrue(edgeIndex.isEdgeIndex()); assertFalse(edgeIndex.isVertexIndex()); verifyVertexIndexContains(managementSystem, Constants.STATE_PROPERTY_KEY); } finally { managementSystem.rollback(); } }
@Test public void verifySystemCompositeIndexes() { AtlasGraph graph = TestUtils.getGraph(); AtlasGraphManagement managementSystem = graph.getManagementSystem(); try { verifySystemCompositeIndex(managementSystem, Constants.GUID_PROPERTY_KEY, true); verifyVertexIndexContains(managementSystem, Constants.GUID_PROPERTY_KEY); verifySystemCompositeIndex(managementSystem, Constants.ENTITY_TYPE_PROPERTY_KEY, false); verifyVertexIndexContains(managementSystem, Constants.ENTITY_TYPE_PROPERTY_KEY); verifySystemCompositeIndex(managementSystem, Constants.SUPER_TYPES_PROPERTY_KEY, false); verifyVertexIndexContains(managementSystem, Constants.SUPER_TYPES_PROPERTY_KEY); verifySystemCompositeIndex(managementSystem, Constants.TRAIT_NAMES_PROPERTY_KEY, false); verifyVertexIndexContains(managementSystem, Constants.TRAIT_NAMES_PROPERTY_KEY); } finally { managementSystem.rollback(); } }
@Test public void verifyFullTextIndex() { AtlasGraph graph = TestUtils.getGraph(); AtlasGraphManagement managementSystem = graph.getManagementSystem(); try { AtlasGraphIndex fullTextIndex = managementSystem.getGraphIndex(Constants.FULLTEXT_INDEX); assertTrue(fullTextIndex.isMixedIndex()); Arrays.asList(fullTextIndex.getFieldKeys()).contains( managementSystem.getPropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY)); } finally { managementSystem.rollback(); } }
@Test public void verifyTypeStoreIndexes() { AtlasGraph graph = TestUtils.getGraph(); AtlasGraphManagement managementSystem = graph.getManagementSystem(); try { verifySystemCompositeIndex(managementSystem, Constants.TYPENAME_PROPERTY_KEY, true); verifyVertexIndexContains(managementSystem, Constants.TYPENAME_PROPERTY_KEY); verifySystemCompositeIndex(managementSystem, Constants.VERTEX_TYPE_PROPERTY_KEY, false); verifyVertexIndexContains(managementSystem, Constants.VERTEX_TYPE_PROPERTY_KEY); } finally { managementSystem.rollback(); } }