Add indexing draft
This commit is contained in:
parent
d4059a89aa
commit
56b86089a6
@ -56,7 +56,23 @@ install(PROGRAMS $<TARGET_FILE:schema>
|
||||
DESTINATION lib/memgraph/query_modules
|
||||
RENAME schema.so)
|
||||
# Also install the source of the example, so user can read it.
|
||||
install(FILES schema.cpp DESTINATION lib/memgraph/query_modules/src)
|
||||
|
||||
install(FILES text_search.cpp DESTINATION lib/memgraph/query_modules/src)
|
||||
add_library(text_search SHARED text_search.cpp)
|
||||
target_include_directories(text_search PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
target_compile_options(text_search PRIVATE -Wall)
|
||||
target_link_libraries(text_search PRIVATE -static-libgcc -static-libstdc++)
|
||||
# Strip C++ example in release build.
|
||||
if (lower_build_type STREQUAL "release")
|
||||
add_custom_command(TARGET text_search POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:text_search>
|
||||
COMMENT "Stripping symbols and sections from the C++ text_search module")
|
||||
endif()
|
||||
install(PROGRAMS $<TARGET_FILE:text_search>
|
||||
DESTINATION lib/memgraph/query_modules
|
||||
RENAME text_search.so)
|
||||
# Also install the source of the example, so user can read it.
|
||||
install(FILES text_search.cpp DESTINATION lib/memgraph/query_modules/src)
|
||||
|
||||
# Install the Python example and modules
|
||||
install(FILES example.py DESTINATION lib/memgraph/query_modules RENAME py_example.py)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
// Copyright 2024 Memgraph Ltd.
|
||||
//
|
||||
// Use of this software is governed by the Business Source License
|
||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
@ -17,6 +17,7 @@
|
||||
#include "storage/v2/id_types.hpp"
|
||||
#include "storage/v2/indices/label_index.hpp"
|
||||
#include "storage/v2/indices/label_property_index.hpp"
|
||||
#include "storage/v2/indices/text_index.hpp"
|
||||
#include "storage/v2/storage_mode.hpp"
|
||||
|
||||
namespace memgraph::storage {
|
||||
@ -30,12 +31,12 @@ struct Indices {
|
||||
Indices &operator=(Indices &&) = delete;
|
||||
~Indices() = default;
|
||||
|
||||
/// This function should be called from garbage collection to clean-up the
|
||||
/// This function should be called from garbage collection to clean up the
|
||||
/// index.
|
||||
/// TODO: unused in disk indices
|
||||
void RemoveObsoleteEntries(uint64_t oldest_active_start_timestamp) const;
|
||||
|
||||
/// Surgical removal of entries that was inserted this transaction
|
||||
/// Surgical removal of entries that were inserted in this transaction
|
||||
/// TODO: unused in disk indices
|
||||
void AbortEntries(LabelId labelId, std::span<Vertex *const> vertices, uint64_t exact_start_timestamp) const;
|
||||
void AbortEntries(PropertyId property, std::span<std::pair<PropertyValue, Vertex *> const> vertices,
|
||||
@ -66,6 +67,7 @@ struct Indices {
|
||||
|
||||
std::unique_ptr<LabelIndex> label_index_;
|
||||
std::unique_ptr<LabelPropertyIndex> label_property_index_;
|
||||
std::unique_ptr<TextIndex> text_index_;
|
||||
};
|
||||
|
||||
} // namespace memgraph::storage
|
||||
|
39
src/storage/v2/indices/text_index.hpp
Normal file
39
src/storage/v2/indices/text_index.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright 2024 Memgraph Ltd.
|
||||
//
|
||||
// Use of this software is governed by the Business Source License
|
||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
// License, and you may not use this file except in compliance with the Business Source License.
|
||||
//
|
||||
// As of the Change Date specified in that file, in accordance with
|
||||
// the Business Source License, use of this software will be governed
|
||||
// by the Apache License, Version 2.0, included in the file
|
||||
// licenses/APL.txt.
|
||||
|
||||
namespace memgraph::storage {
|
||||
|
||||
class TextIndex {
|
||||
public:
|
||||
TextIndex() = default;
|
||||
|
||||
TextIndex(const TextIndex &) = delete;
|
||||
TextIndex(TextIndex &&) = delete;
|
||||
TextIndex &operator=(const TextIndex &) = delete;
|
||||
TextIndex &operator=(TextIndex &&) = delete;
|
||||
|
||||
virtual ~TextIndex() = default;
|
||||
|
||||
virtual void UpdateOnAddLabel(LabelId added_label, Vertex *vertex_after_update, const Transaction &tx) = 0;
|
||||
|
||||
// Not used for in-memory
|
||||
virtual void UpdateOnRemoveLabel(LabelId removed_label, Vertex *vertex_after_update, const Transaction &tx) = 0;
|
||||
|
||||
virtual bool DropIndex(LabelId label) = 0;
|
||||
|
||||
virtual bool IndexExists(LabelId label) const = 0;
|
||||
|
||||
virtual std::vector<LabelId> ListIndices() const = 0;
|
||||
|
||||
virtual uint64_t ApproximateVertexCount(LabelId label) const = 0;
|
||||
};
|
||||
|
||||
} // namespace memgraph::storage
|
Loading…
Reference in New Issue
Block a user