Solr 9.2 - 密集向量搜索

问题描述 投票:0回答:1

我们正在测试 ** solr 9.2** 密集向量搜索

首先,我们编辑了managed-schema.xml

   
    <fieldType name="knn_vector" class="solr.DenseVectorField" vectorDimension="4"/>  
    <dynamicField name="*_vtr" type="knn_vector" indexed="true" stored="true"/>

然后,我们重启Solr。

接下来,我们创建了一个小合集:

curl --request POST \
--url http://localhost:8983/api/collections \
--header 'Content-Type: application/json' \
--data '{
  "create": {
    "name": "teste7",
    "numShards": 1,
    "replicationFactor": 1
  }
}'

然后,我们插入并提交数据:

curl --request POST \
  --url 'http://localhost:8983/api/collections/teste7/update' \
  --header 'Content-Type: application/json' \
  --data '  [{ "id": "1",
"vector2_vtr": [1.0, 2.5, 3.7, 4.1]
},
{ "id": "2",
"vector2_vtr": [1.5, 5.5, 6.7, 65.1]
}
]'

curl -X POST -H 'Content-type: application/json' -d '{"set-property":{"updateHandler.autoCommit.maxTime":15000}}' http://localhost:8983/api/collections/teste7/config

这是数据

enter image description here

这是架构

enter image description here

但是,当我们搜索

q={!knn f=vector2_vtr topK=10}[1.0, 2.0, 3.0, 4.0]

我们收到错误:

"error-class","org.apache.solr.common.SolrException",       "root-error-class","org.apache.solr.common.SolrException"],     "msg":"only DenseVectorField is compatible with Knn Query Parser",

enter image description here

密集向量搜索相对较新,我们找不到太多信息或完整示例。

有理想吗?

search vector solr
1个回答
0
投票

错误是由于

vector2_vtr
字段没有被索引为DenseVectorField。

在共享的“模式图像”中,

vector2_vtr

Field-Type: org.apache.solr.schema.DoublePointField

代替:

Field-Type: org.apache.solr.schema.DenseVectorField

就像在这种情况下:

© www.soinside.com 2019 - 2024. All rights reserved.