Create index command should not delete existing index

This commit is contained in:
Sebastien Ros 2015-08-26 14:42:18 -07:00
parent 4cec35daf8
commit 79a0ae86e8

View File

@ -47,8 +47,19 @@ namespace Orchard.Indexing.Commands {
Context.Output.WriteLine(T("Invalid index name."));
}
else {
_indexManager.GetSearchIndexProvider().CreateIndex(index);
Context.Output.WriteLine(T("New index has been created successfully."));
var indexProvider = _indexManager.GetSearchIndexProvider();
if(indexProvider == null) {
Context.Output.WriteLine(T("New indexing service was found. Please enable a module like Lucene."));
}
else {
if (indexProvider.Exists(index)) {
Context.Output.WriteLine(T("The specified index already exists."));
}
else {
_indexManager.GetSearchIndexProvider().CreateIndex(index);
Context.Output.WriteLine(T("New index has been created successfully."));
}
}
}
}