Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Merge branch 'v0.25-join' into v0.26-facets

Kishore Nallan888091d2dc6d
diff --cc include/field.h
index f63afe34,6b4ee937..7160762e
--- a/include/field.h
+++ b/include/field.h
@@@ -52,9 -52,7 +52,8 @@@ namespace fields
static const std::string reference = "reference";
static const std::string embed = "embed";
static const std::string from = "from";
- static const std::string embed_from = "embed_from";
static const std::string model_name = "model_name";
+ static const std::string range_index = "range_index";
// Some models require additional parameters to be passed to the model during indexing/querying
// For e.g. e5-small model requires prefix "passage:" for indexing and "query:" for querying
diff --cc test/collection_all_fields_test.cpp
index c56915dc,e76bb45a..2dc8dd04
--- a/test/collection_all_fields_test.cpp
+++ b/test/collection_all_fields_test.cpp
@@@ -1678,23 -1679,26 +1679,17 @@@ TEST_F(CollectionAllFieldsTest, EmbedFr
}
TEST_F(CollectionAllFieldsTest, WrongDataTypeForEmbedFrom) {
-- TextEmbedderManager::set_model_dir("/tmp/typesense_test/models");
-- nlohmann::json field_json;
-- field_json["name"] = "embedding";
-- field_json["type"] = "float[]";
-- field_json["embed"] = nlohmann::json::object();
-- field_json["embed"]["from"] = {"age"};
-- field_json["embed"]["model_config"] = nlohmann::json::object();
-- field_json["embed"]["model_config"]["model_name"] = "ts/e5-small";
--
- std::vector<field> fields;
- std::string fallback_field_type;
- auto arr = nlohmann::json::array();
- arr.push_back(field_json);
- field_json["name"] = "age";
- field_json["type"] = "int32";
- arr.push_back(field_json);
- auto field_op = field::json_fields_to_fields(false, arr, fallback_field_type, fields);
- ASSERT_FALSE(field_op.ok());
- ASSERT_EQ("Property `embed.from` can only refer to string or string array fields.", field_op.error());
+ nlohmann::json schema = R"({
+ "name": "obj_coll",
+ "fields": [
+ {"name": "age", "type": "int32"},
+ {"name": "embedding", "type":"float[]", "embed":{"from": ["age"],
+ "model_config": {"model_name": "ts/e5-small"}}}
+ ]
+ })"_json;
+
+ auto obj_coll_op = collectionManager.create_collection(schema);
+
+ ASSERT_FALSE(obj_coll_op.ok());
+ ASSERT_EQ("Property `embed.from` can only refer to string or string array fields.", obj_coll_op.error());
}