使用不同的 table 列进行 sphinx 搜索权重排序
Use different table column for sphinx search weight sorting
而不是 sphinx 中的默认排序,我想要 sort/weight 基于另一个 table 中的字段的结果。我的架构如下所示:
node {
id
weight
}
node_text {
id
node_id
text
}
(注:每个节点只有一个node_text)
我想索引 node_text
,但能够 return 按 node.weight
排序的 sphinx 结果。我假设我需要这样的东西:
sql_query = SELECT node_id, text from node_text
sql_joined_field = weight from query; SELECT id, weight FROM node ORDER BY id ASC
这是搜索匹配项 ORDER BY node.weight DESC
的正确方法吗?我希望能够 运行 如下查询:
mysql> SELECT * FROM nodetest1 WHERE MATCH('foobar') ORDER BY weight DESC; SHOW META;
sql_joined_field
,生成一个字段,你需要weight
存储在一个属性中。最简单的是简单的加入...
sql_query = select node_id, text, weight from node_text inner join node using (node_id=node.id)
sql_uint_attr = weight
那应该对你 SphinxQL 查询有用:)
而不是 sphinx 中的默认排序,我想要 sort/weight 基于另一个 table 中的字段的结果。我的架构如下所示:
node {
id
weight
}
node_text {
id
node_id
text
}
(注:每个节点只有一个node_text)
我想索引 node_text
,但能够 return 按 node.weight
排序的 sphinx 结果。我假设我需要这样的东西:
sql_query = SELECT node_id, text from node_text
sql_joined_field = weight from query; SELECT id, weight FROM node ORDER BY id ASC
这是搜索匹配项 ORDER BY node.weight DESC
的正确方法吗?我希望能够 运行 如下查询:
mysql> SELECT * FROM nodetest1 WHERE MATCH('foobar') ORDER BY weight DESC; SHOW META;
sql_joined_field
,生成一个字段,你需要weight
存储在一个属性中。最简单的是简单的加入...
sql_query = select node_id, text, weight from node_text inner join node using (node_id=node.id)
sql_uint_attr = weight
那应该对你 SphinxQL 查询有用:)