Add text index existence checking and search
This commit is contained in:
parent
fe7e230e21
commit
5b22a7d3a4
@ -553,6 +553,8 @@ class DbAccessor final {
|
||||
return accessor_->LabelPropertyIndexExists(label, prop);
|
||||
}
|
||||
|
||||
bool TextIndexExists(storage::LabelId label) const { return accessor_->TextIndexExists(label); }
|
||||
|
||||
std::optional<storage::LabelIndexStats> GetIndexStats(const storage::LabelId &label) const {
|
||||
return accessor_->GetIndexStats(label);
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ class TextIndex {
|
||||
|
||||
bool IndexExists(LabelId label) { return index_.contains(label); }
|
||||
|
||||
mgcxx_mock::text_search::SearchOutput Search(LabelId label, mgcxx_mock::text_search::SearchInput input) {
|
||||
return mgcxx_mock::text_search::Mock::search(index_.at(label), input);
|
||||
}
|
||||
|
||||
std::vector<LabelId> ListIndices() {
|
||||
std::vector<LabelId> ret;
|
||||
ret.reserve(index_.size());
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "storage/v2/durability/wal.hpp"
|
||||
#include "storage/v2/edge_accessor.hpp"
|
||||
#include "storage/v2/indices/indices.hpp"
|
||||
#include "storage/v2/mgcxx_mock.hpp"
|
||||
#include "storage/v2/mvcc.hpp"
|
||||
#include "storage/v2/replication/enums.hpp"
|
||||
#include "storage/v2/replication/replication_client.hpp"
|
||||
@ -211,6 +212,8 @@ class Storage {
|
||||
|
||||
virtual bool LabelPropertyIndexExists(LabelId label, PropertyId property) const = 0;
|
||||
|
||||
bool TextIndexExists(LabelId label) const { return storage_->indices_.text_index_->IndexExists(label); }
|
||||
|
||||
virtual IndicesInfo ListAllIndices() const = 0;
|
||||
|
||||
virtual ConstraintsInfo ListAllConstraints() const = 0;
|
||||
@ -247,6 +250,11 @@ class Storage {
|
||||
|
||||
std::vector<EdgeTypeId> ListAllPossiblyPresentEdgeTypes() const;
|
||||
|
||||
mgcxx_mock::text_search::SearchOutput TextSearch(LabelId label,
|
||||
mgcxx_mock::text_search::SearchInput &search_input) const {
|
||||
return storage_->indices_.text_index_->Search(label, search_input);
|
||||
}
|
||||
|
||||
virtual utils::BasicResult<StorageIndexDefinitionError, void> CreateIndex(LabelId label) = 0;
|
||||
|
||||
virtual utils::BasicResult<StorageIndexDefinitionError, void> CreateIndex(LabelId label, PropertyId property) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user