Add preliminary mock and PropertyStore modifications
This commit is contained in:
parent
f11b3c6d9d
commit
df82b05725
@ -105,7 +105,8 @@ enum class Type : uint8_t {
|
||||
STRING = 0x50,
|
||||
LIST = 0x60,
|
||||
MAP = 0x70,
|
||||
TEMPORAL_DATA = 0x80
|
||||
TEMPORAL_DATA = 0x80,
|
||||
EXTERNALLY_STORED = 0x90
|
||||
};
|
||||
|
||||
const uint8_t kMaskType = 0xf0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <json/json.hpp>
|
||||
|
||||
#include <limits>
|
||||
|
||||
@ -21,6 +22,33 @@
|
||||
|
||||
using testing::UnorderedElementsAre;
|
||||
|
||||
struct SearchResult {
|
||||
std::uint64_t id;
|
||||
nlohmann::json document;
|
||||
double score;
|
||||
};
|
||||
|
||||
class TantivyMock {
|
||||
enum class Consistency : uint8_t { DEFAULT };
|
||||
|
||||
std::string INDEX = ""; // placeholder
|
||||
|
||||
std::map<std::string, std::map<std::uint64_t, nlohmann::json>> storage{}; // index_name: {document_id: document}
|
||||
|
||||
void CreateAllPropsIndex(std::string name, std::string tokenizer, Consistency consistency = Consistency::DEFAULT) {}
|
||||
|
||||
void DropIndex(std::string index_name) { storage.erase(index_name); }
|
||||
|
||||
void AddDocument(std::uint64_t id, nlohmann::json document) { storage[INDEX][id] = document; }
|
||||
|
||||
void DeleteDocument(std::uint64_t id) { storage[INDEX].erase(id); }
|
||||
|
||||
SearchResult Search(std::string index_name, std::string search_query) {
|
||||
auto mock_result = storage[index_name].begin();
|
||||
return SearchResult{.id = mock_result->first, .document = mock_result->second, .score = 1.0};
|
||||
}
|
||||
};
|
||||
|
||||
const memgraph::storage::PropertyValue kSampleValues[] = {
|
||||
memgraph::storage::PropertyValue(),
|
||||
memgraph::storage::PropertyValue(false),
|
||||
|
Loading…
Reference in New Issue
Block a user