Fix text index existence error messages
This commit is contained in:
parent
00bdd8ac96
commit
d7fc3bb65a
@ -2713,7 +2713,6 @@ PreparedQuery PrepareTextIndexQuery(ParsedQuery parsed_query, bool in_explicit_t
|
||||
case TextIndexQuery::Action::CREATE: {
|
||||
index_notification.code = NotificationCode::CREATE_INDEX;
|
||||
index_notification.title = fmt::format("Created text index on label {}.", text_index_query->label_.name);
|
||||
|
||||
// TODO: not just storage + invalidate_plan_cache. Need a DB transaction (for replication)
|
||||
handler = [dba, label, index_name,
|
||||
invalidate_plan_cache = std::move(invalidate_plan_cache)](Notification &index_notification) {
|
||||
|
@ -28,6 +28,10 @@ void TextIndex::CreateEmptyIndex(const std::string &index_name, LabelId label) {
|
||||
throw query::TextSearchDisabledException();
|
||||
}
|
||||
|
||||
if (index_.contains(index_name)) {
|
||||
throw query::TextSearchException("Text index \"{}\" already exists.", index_name);
|
||||
}
|
||||
|
||||
try {
|
||||
nlohmann::json mappings = {};
|
||||
mappings["properties"] = {};
|
||||
@ -231,7 +235,9 @@ LabelId TextIndex::DropIndex(const std::string &index_name) {
|
||||
throw query::TextSearchDisabledException();
|
||||
}
|
||||
|
||||
// TODO antepusic check if index exists
|
||||
if (!index_.contains(index_name)) {
|
||||
throw query::TextSearchException("Text index \"{}\" doesn’t exist.", index_name);
|
||||
}
|
||||
|
||||
try {
|
||||
mgcxx::text_search::drop_index(index_name);
|
||||
|
Loading…
Reference in New Issue
Block a user