Add text indices to SHOW INDEX INFO
This commit is contained in:
parent
dbd3835ba2
commit
0335030c93
@ -2999,10 +2999,11 @@ PreparedQuery PrepareDatabaseInfoQuery(ParsedQuery parsed_query, bool in_explici
|
|||||||
auto *storage = database->storage();
|
auto *storage = database->storage();
|
||||||
const std::string_view label_index_mark{"label"};
|
const std::string_view label_index_mark{"label"};
|
||||||
const std::string_view label_property_index_mark{"label+property"};
|
const std::string_view label_property_index_mark{"label+property"};
|
||||||
|
const std::string_view text_index_mark{"text"};
|
||||||
auto info = dba->ListAllIndices();
|
auto info = dba->ListAllIndices();
|
||||||
auto storage_acc = database->Access();
|
auto storage_acc = database->Access();
|
||||||
std::vector<std::vector<TypedValue>> results;
|
std::vector<std::vector<TypedValue>> results;
|
||||||
results.reserve(info.label.size() + info.label_property.size());
|
results.reserve(info.label.size() + info.label_property.size() + info.text.size());
|
||||||
for (const auto &item : info.label) {
|
for (const auto &item : info.label) {
|
||||||
results.push_back({TypedValue(label_index_mark), TypedValue(storage->LabelToName(item)), TypedValue(),
|
results.push_back({TypedValue(label_index_mark), TypedValue(storage->LabelToName(item)), TypedValue(),
|
||||||
TypedValue(static_cast<int>(storage_acc->ApproximateVertexCount(item)))});
|
TypedValue(static_cast<int>(storage_acc->ApproximateVertexCount(item)))});
|
||||||
@ -3013,6 +3014,9 @@ PreparedQuery PrepareDatabaseInfoQuery(ParsedQuery parsed_query, bool in_explici
|
|||||||
TypedValue(storage->PropertyToName(item.second)),
|
TypedValue(storage->PropertyToName(item.second)),
|
||||||
TypedValue(static_cast<int>(storage_acc->ApproximateVertexCount(item.first, item.second)))});
|
TypedValue(static_cast<int>(storage_acc->ApproximateVertexCount(item.first, item.second)))});
|
||||||
}
|
}
|
||||||
|
for (const auto &item : info.text) {
|
||||||
|
results.push_back({TypedValue(text_index_mark), TypedValue(item), TypedValue(), TypedValue()});
|
||||||
|
}
|
||||||
std::sort(results.begin(), results.end(), [&label_index_mark](const auto &record_1, const auto &record_2) {
|
std::sort(results.begin(), results.end(), [&label_index_mark](const auto &record_1, const auto &record_2) {
|
||||||
const auto type_1 = record_1[0].ValueString();
|
const auto type_1 = record_1[0].ValueString();
|
||||||
const auto type_2 = record_2[0].ValueString();
|
const auto type_2 = record_2[0].ValueString();
|
||||||
|
@ -2055,7 +2055,8 @@ IndicesInfo DiskStorage::DiskAccessor::ListAllIndices() const {
|
|||||||
auto *disk_label_index = static_cast<DiskLabelIndex *>(on_disk->indices_.label_index_.get());
|
auto *disk_label_index = static_cast<DiskLabelIndex *>(on_disk->indices_.label_index_.get());
|
||||||
auto *disk_label_property_index =
|
auto *disk_label_property_index =
|
||||||
static_cast<DiskLabelPropertyIndex *>(on_disk->indices_.label_property_index_.get());
|
static_cast<DiskLabelPropertyIndex *>(on_disk->indices_.label_property_index_.get());
|
||||||
return {disk_label_index->ListIndices(), disk_label_property_index->ListIndices()};
|
auto *text_index = storage_->indices_.text_index_.get();
|
||||||
|
return {disk_label_index->ListIndices(), disk_label_property_index->ListIndices(), text_index->ListIndices()};
|
||||||
}
|
}
|
||||||
ConstraintsInfo DiskStorage::DiskAccessor::ListAllConstraints() const {
|
ConstraintsInfo DiskStorage::DiskAccessor::ListAllConstraints() const {
|
||||||
auto *disk_storage = static_cast<DiskStorage *>(storage_);
|
auto *disk_storage = static_cast<DiskStorage *>(storage_);
|
||||||
|
@ -2168,7 +2168,8 @@ IndicesInfo InMemoryStorage::InMemoryAccessor::ListAllIndices() const {
|
|||||||
auto *mem_label_index = static_cast<InMemoryLabelIndex *>(in_memory->indices_.label_index_.get());
|
auto *mem_label_index = static_cast<InMemoryLabelIndex *>(in_memory->indices_.label_index_.get());
|
||||||
auto *mem_label_property_index =
|
auto *mem_label_property_index =
|
||||||
static_cast<InMemoryLabelPropertyIndex *>(in_memory->indices_.label_property_index_.get());
|
static_cast<InMemoryLabelPropertyIndex *>(in_memory->indices_.label_property_index_.get());
|
||||||
return {mem_label_index->ListIndices(), mem_label_property_index->ListIndices()};
|
auto *text_index = storage_->indices_.text_index_.get();
|
||||||
|
return {mem_label_index->ListIndices(), mem_label_property_index->ListIndices(), text_index->ListIndices()};
|
||||||
}
|
}
|
||||||
ConstraintsInfo InMemoryStorage::InMemoryAccessor::ListAllConstraints() const {
|
ConstraintsInfo InMemoryStorage::InMemoryAccessor::ListAllConstraints() const {
|
||||||
const auto *mem_storage = static_cast<InMemoryStorage *>(storage_);
|
const auto *mem_storage = static_cast<InMemoryStorage *>(storage_);
|
||||||
|
@ -60,6 +60,7 @@ class EdgeAccessor;
|
|||||||
struct IndicesInfo {
|
struct IndicesInfo {
|
||||||
std::vector<LabelId> label;
|
std::vector<LabelId> label;
|
||||||
std::vector<std::pair<LabelId, PropertyId>> label_property;
|
std::vector<std::pair<LabelId, PropertyId>> label_property;
|
||||||
|
std::vector<std::string> text;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConstraintsInfo {
|
struct ConstraintsInfo {
|
||||||
|
Loading…
Reference in New Issue
Block a user