Rename an unclearly-named procedure and improve error message
This commit is contained in:
parent
70a53cd2b8
commit
445b20e665
src/storage/v2/indices
@ -279,7 +279,8 @@ LabelId TextIndex::DropIndex(const std::string &index_name) {
|
|||||||
|
|
||||||
bool TextIndex::IndexExists(const std::string &index_name) const { return index_.contains(index_name); }
|
bool TextIndex::IndexExists(const std::string &index_name) const { return index_.contains(index_name); }
|
||||||
|
|
||||||
mgcxx::text_search::SearchOutput TextIndex::TQLSearch(const std::string &index_name, const std::string &search_query) {
|
mgcxx::text_search::SearchOutput TextIndex::SearchGivenProperties(const std::string &index_name,
|
||||||
|
const std::string &search_query) {
|
||||||
auto input = mgcxx::text_search::SearchInput{.search_query = search_query, .return_fields = {"data", "metadata"}};
|
auto input = mgcxx::text_search::SearchInput{.search_query = search_query, .return_fields = {"data", "metadata"}};
|
||||||
mgcxx::text_search::SearchOutput search_results;
|
mgcxx::text_search::SearchOutput search_results;
|
||||||
try {
|
try {
|
||||||
@ -334,13 +335,15 @@ std::vector<Gid> TextIndex::Search(const std::string &index_name, const std::str
|
|||||||
|
|
||||||
mgcxx::text_search::SearchOutput search_results;
|
mgcxx::text_search::SearchOutput search_results;
|
||||||
if (search_mode == "specify_property") {
|
if (search_mode == "specify_property") {
|
||||||
search_results = TQLSearch(index_name, search_query);
|
search_results = SearchGivenProperties(index_name, search_query);
|
||||||
} else if (search_mode == "regex") {
|
} else if (search_mode == "regex") {
|
||||||
search_results = RegexSearch(index_name, search_query);
|
search_results = RegexSearch(index_name, search_query);
|
||||||
} else if (search_mode == "all_properties") {
|
} else if (search_mode == "all_properties") {
|
||||||
search_results = SearchAllProperties(index_name, search_query);
|
search_results = SearchAllProperties(index_name, search_query);
|
||||||
} else {
|
} else {
|
||||||
throw query::TextSearchException("Unsupported search type"); // TODO improve
|
throw query::TextSearchException(
|
||||||
|
"Unsupported search mode: please use one of text_search.search, text_search.search_all, or "
|
||||||
|
"text_search.regex_search.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Gid> found_nodes;
|
std::vector<Gid> found_nodes;
|
||||||
|
@ -46,7 +46,8 @@ class TextIndex {
|
|||||||
|
|
||||||
void CommitLoadedNodes(mgcxx::text_search::Context &index_context);
|
void CommitLoadedNodes(mgcxx::text_search::Context &index_context);
|
||||||
|
|
||||||
mgcxx::text_search::SearchOutput TQLSearch(const std::string &index_name, const std::string &search_query);
|
mgcxx::text_search::SearchOutput SearchGivenProperties(const std::string &index_name,
|
||||||
|
const std::string &search_query);
|
||||||
|
|
||||||
mgcxx::text_search::SearchOutput RegexSearch(const std::string &index_name, const std::string &search_query);
|
mgcxx::text_search::SearchOutput RegexSearch(const std::string &index_name, const std::string &search_query);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user