Java Code Examples for com.orientechnologies.orient.core.index.OIndex#delete()

The following examples show how to use com.orientechnologies.orient.core.index.OIndex#delete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OLuceneIndexPlugin.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
  OLogManager.instance().info(this, "Dropping Lucene indexes...");
  for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
    if (idx.getInternal() instanceof OLuceneIndex) {
      OLogManager.instance().info(this, "- index '%s'", idx.getName());
      idx.delete();
    }
  }
}
 
Example 2
Source File: OLuceneIndexFactory.java    From orientdb-lucene with Apache License 2.0 5 votes vote down vote up
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
  try {
    OLogManager.instance().debug(this, "Dropping Lucene indexes...");
    for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
      if (idx.getInternal() instanceof OLuceneIndex) {
        OLogManager.instance().debug(this, "- index '%s'", idx.getName());
        idx.delete();
      }
    }
  } catch (Exception e) {
    OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e);
  }
}
 
Example 3
Source File: PerspectivesModule.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void onUpdate(OrienteerWebApplication app, ODatabaseDocument db,
		int oldVersion, int newVersion) {
	int toVersion = oldVersion+1;
	switch (toVersion) {
		case 2:
			convertNameProperty(app, db, OPerspective.CLASS_NAME);
			convertNameProperty(app, db, OPerspectiveItem.CLASS_NAME);
			break;
		case 3:
			onInstall(app, db);
			break;
		case 4:
			OIndex<?> index = db.getMetadata().getIndexManager().getIndex(OPerspective.CLASS_NAME + ".name");
			if(index!=null) index.delete();
			onInstall(app, db);
			break;
		case 5:
			OSchemaHelper.bind(db)
				.oClass(OIdentity.CLASS_NAME)
				.oProperty(PROP_PERSPECTIVE, OType.LINK).linkedClass(OPerspective.CLASS_NAME);
			break;
		case 6:
			OSchemaHelper helper = OSchemaHelper.bind(db);
			
			helper.oClass(OPerspective.CLASS_NAME)
				.oProperty(OPerspective.PROP_ALIAS, OType.STRING, 10);
			db.command(new OCommandSQL("update OPerspective set alias=name['en'].toLowerCase() where alias is null"))
				.execute();
			helper.notNull()
				.oIndex(INDEX_TYPE.UNIQUE);
			//update aliases
			helper.oClass(OPerspectiveItem.CLASS_NAME)
				.oProperty(OPerspectiveItem.PROP_ALIAS, OType.STRING, 10);
			db.command(new OCommandSQL("update OPerspectiveItem set alias=name['en'].toLowerCase() where alias is null"))
				.execute();
			helper.notNull();
			break;
		case 7:
			OSchemaHelper.bind(db)
				.oClass(OPerspective.CLASS_NAME)
					.oProperty(OPerspective.PROP_FEATURES, OType.EMBEDDEDSET, 60)
					.linkedType(OType.STRING);
		default:
			break;
	}
	if(toVersion<newVersion) onUpdate(app, db, toVersion, newVersion);
}