Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 使用不同的表列进行sphinx搜索权重排序_Mysql_Sorting_Sphinx - Fatal编程技术网

Mysql 使用不同的表列进行sphinx搜索权重排序

Mysql 使用不同的表列进行sphinx搜索权重排序,mysql,sorting,sphinx,Mysql,Sorting,Sphinx,与中的默认排序不同,我希望根据另一个表中的字段对结果进行排序/加权。我的模式如下所示: node { id weight } node_text { id node_id text } sql_query = SELECT node_id, text from node_text sql_joined_field = weight from query; SELECT id, weight FROM node ORDER BY id ASC 注意:每个节点只有一个节点

与中的默认排序不同,我希望根据另一个表中的字段对结果进行排序/加权。我的模式如下所示:

node {
  id
  weight
}

node_text {
  id
  node_id
  text
}
sql_query = SELECT node_id, text from node_text

sql_joined_field = weight from query; SELECT id, weight FROM node ORDER BY id ASC
注意:每个节点只有一个节点\文本

我想索引node_文本,但能够返回按node.weight排序的sphinx结果。我假设我需要这样的东西:

node {
  id
  weight
}

node_text {
  id
  node_id
  text
}
sql_query = SELECT node_id, text from node_text

sql_joined_field = weight from query; SELECT id, weight FROM node ORDER BY id ASC
这是按node.weight DESC搜索匹配项的正确方法吗?我希望能够运行如下查询:

mysql> SELECT * FROM nodetest1 WHERE MATCH('foobar') ORDER BY weight DESC; SHOW META;
sql_加入_字段,生成一个字段,需要将权重存储在属性中。最简单的将是一个简单的连接

sql_query = select node_id, text, weight from node_text inner join node using (node_id=node.id)
sql_uint_attr = weight
这应该适用于SphinxQL查询: