public static int GetHashCode(RavenIndexDataModel indexModel) { var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName); var definition = documentStore.DatabaseCommands.GetIndex(indexModel.IndexName); if (documentStore == null) { throw new InvalidOperationException("Index definition is null."); } return definition.GetHashCode(); }
public static void Copy(RavenIndexDataModel indexModel, string targetServerName) { var sourceStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName); var targetStore = GetTenantDocumentStore(targetServerName, indexModel.StoreName); var sourceIndexDefinition = sourceStore.DatabaseCommands.GetIndex(indexModel.IndexName); if (sourceIndexDefinition == null) { throw new InvalidOperationException("Index definition is null."); } targetStore.DatabaseCommands .PutIndex(indexModel.IndexName, sourceIndexDefinition, overwrite: true); }
public static QueryResult GetZeroPageQueryResult(RavenIndexDataModel indexModel) { var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName); var queryResult = documentStore.DatabaseCommands .Query(indexModel.IndexName, new IndexQuery { PageSize = 0 }, null); return queryResult; }
public static void Delete(RavenIndexDataModel indexModel) { var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName); documentStore.DatabaseCommands.DeleteIndex(indexModel.IndexName); }