代码拉取完成,页面将自动刷新
向量检索是指用一组数字(向量)来量化一个事物,用大量向量来表示事物集合,用向量计算的方式寻找相似事物的一种检索方式。
isearch底层采用的向量检索框架为Facebook AI的Faiss,项目地址为:https://github.com/facebookresearch/faiss
在app_field_define表定义时,vector字段类型需定义好dim、index_type和metric_type三个属性,示例如下:
{
"id":3,
"appId":10065,
"fieldName":"float_vector",
"fieldType":15,
"fieldId":3,
"IsPrimaryKey":0,
"indexTag":0,
"snapshotTag":1,
"segmentTag":0,
"segmentFeature":0,
"unionField":"",
"createTime":"2021/4/13 15:49:09",
"dim":128, // 维数
"index_type": [" PCA80,Flat "], // 索引类型,格式与faiss对外工厂类设置保持一致
"metric_type": "L2" // 距离计算方式,可选值:InnerProduct、L2
}
说明:index_type参考https://github.com/facebookresearch/faiss/wiki/The-index-factory
curl -X POST \
http://127.0.0.1/insert \
-H 'content-type: application/json' \
-H 'doc_id: 1' \
-d '{"appid":10065,"table_content":{"cmd":"add","fields":{"doc_id":"1","random_value":1488981884,"float_vector":[0.005653954876242762, 0.632130963117687, 0.7519577013172226, 0.8568273368123129, 0.2034335192251041, 0.9786219451736441, 0.5948105950093241, 0.9618089054657426]}}}'
curl -X POST \
http://127.0.0.1/search \
-H 'content-type: application/json' \
-d '{"appid":10065,"query":{"vector_query":{"float_vector":[0.005653954876242762, 0.632130963117687, 0.7519577013172226, 0.8568273368123129, 0.2034335192251041, 0.9786219451736441, 0.5948105950093241, 0.9618089054657426], "index_type_id":1}} }'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。