Apache Solr搜索距离计算

Apache Solr Search for Distance Calculation

您好,我正在使用 Apache solr v8

我需要在查询搜索中计算 n-dim 向量之间的距离, 我该怎么做。

因为我需要计算 python 的 Face_recognition 模块

中人脸编码向量之间的距离

编辑: Solr中有一个dist函数,见楼主的回答

Solr 尚不支持近似近邻 (ANN) 向量搜索。目前正在努力将其集成到 Solr 和 Lucene 中。您可以在这张 Solr Jira 票证上找到详细的分析和跟踪进度:https://issues.apache.org/jira/browse/SOLR-14397

工单上还有 "Note on Prior Approaches" 部分总结了 solutions/workarounds 到目前为止该问题。

回答: 距离公式应适用于排序字段

sort : dist(2, db_vector_header, user_vector) asc