Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
addressed yee's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-starry-sky committed May 24, 2021
1 parent eeda8d3 commit d05aa5f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
11 changes: 6 additions & 5 deletions src/parser/MaintainSentences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,15 @@ std::string DropHostFromZoneSentence::toString() const {
std::string CreateFTIndexSentence::toString() const {
std::string buf;
buf.reserve(256);
buf += "CREATE FULLTEXT INDEX ";
buf += *indexName_;
buf += " ON ";
buf += "CREATE FULLTEXT ";
if (isEdge_) {
buf += " EDGE ";
buf += "EDGE";
} else {
buf += " TAG ";
buf += "TAG";
}
buf += " INDEX ";
buf += *indexName_;
buf += " ON ";
buf += *schemaName_;
buf += "(";
std::vector<std::string> fieldDefs;
Expand Down
8 changes: 4 additions & 4 deletions src/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -2278,11 +2278,11 @@ create_edge_index_sentence
;

create_fulltext_index_sentence
: KW_CREATE KW_FULLTEXT KW_INDEX name_label KW_ON KW_TAG name_label L_PAREN name_label_list R_PAREN {
$$ = new CreateFTIndexSentence(false, $4, $7, $9);
: KW_CREATE KW_FULLTEXT KW_TAG KW_INDEX name_label KW_ON name_label L_PAREN name_label_list R_PAREN {
$$ = new CreateFTIndexSentence(false, $5, $7, $9);
}
| KW_CREATE KW_FULLTEXT KW_INDEX name_label KW_ON KW_EDGE name_label L_PAREN name_label_list R_PAREN {
$$ = new CreateFTIndexSentence(true, $4, $7, $9);
| KW_CREATE KW_FULLTEXT KW_EDGE KW_INDEX name_label KW_ON name_label L_PAREN name_label_list R_PAREN {
$$ = new CreateFTIndexSentence(true, $5, $7, $9);
}
;

Expand Down
18 changes: 8 additions & 10 deletions src/util/FTIndexUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,30 @@ StatusOr<bool>
FTIndexUtils::checkTSIndex(const std::vector<nebula::plugin::HttpClient>& tsClients,
const std::string& index) {
auto retryCnt = FLAGS_ft_request_retry_times;
StatusOr<bool> ret = Status::Error("fulltext index get failed : %s", index.c_str());
while (--retryCnt > 0) {
ret = nebula::plugin::ESGraphAdapter::kAdapter->indexExists(randomFTClient(tsClients),
index);
auto ret = nebula::plugin::ESGraphAdapter::kAdapter->indexExists(randomFTClient(tsClients),
index);
if (!ret.ok()) {
continue;
}
return ret.value();
return std::move(ret).value();
}
return ret.status();
return Status::Error("fulltext index get failed : %s", index.c_str());
}

StatusOr<bool>
FTIndexUtils::dropTSIndex(const std::vector<nebula::plugin::HttpClient>& tsClients,
const std::string& index) {
auto retryCnt = FLAGS_ft_request_retry_times;
StatusOr<bool> ret = Status::Error("drop fulltext index failed : %s", index.c_str());
while (--retryCnt > 0) {
ret = nebula::plugin::ESGraphAdapter::kAdapter->dropIndex(randomFTClient(tsClients),
index);
auto ret = nebula::plugin::ESGraphAdapter::kAdapter->dropIndex(randomFTClient(tsClients),
index);
if (!ret.ok()) {
continue;
}
return ret.value();
return std::move(ret).value();
}
return ret.status();
return Status::Error("drop fulltext index failed : %s", index.c_str());
}

StatusOr<std::string> FTIndexUtils::rewriteTSFilter(bool isEdge, Expression* expr,
Expand Down

0 comments on commit d05aa5f

Please sign in to comment.