mirror of
https://github.com/typesense/typesense.git
synced 2025-05-20 13:42:26 +08:00
Index foo_sequence_id
field that stores sequence_id of referenced document.
This commit is contained in:
parent
297409f105
commit
249294a657
@ -697,6 +697,13 @@ Option<bool> field::json_field_to_field(bool enable_nested_fields, nlohmann::jso
|
||||
field_json[fields::reference])
|
||||
);
|
||||
|
||||
if (!field_json[fields::reference].get<std::string>().empty()) {
|
||||
the_fields.emplace_back(
|
||||
field(field_json[fields::name].get<std::string>() + "_sequence_id", "string", false,
|
||||
false, true)
|
||||
);
|
||||
}
|
||||
|
||||
return Option<bool>(true);
|
||||
}
|
||||
|
||||
|
@ -92,5 +92,10 @@ TEST_F(CollectionJoinTest, SchemaReferenceField) {
|
||||
|
||||
ASSERT_EQ(schema.at("customer_name").reference, "");
|
||||
ASSERT_EQ(schema.at("product_id").reference, "Products.product_id");
|
||||
ASSERT_EQ(schema.count("product_id_sequence_id"), 1);
|
||||
|
||||
auto field = schema.at("product_id_sequence_id");
|
||||
ASSERT_TRUE(field.index);
|
||||
|
||||
collectionManager.drop_collection("Customers");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user