我想要做的是按相似性/相似性排序问题,然后根据Result
表格中的点从 Point
表格中获取结果。
示例:查询 = '德国位置'
我有以下表格:
表问题
+---------+-----------+---------------+---------------------------------+
| ques_id | question |
+---------+-----------+---------------+---------------------------------+
| 1 | Where is Germany located |
+---------+-----------+---------------+---------------------------------+
| 2 | where is Germany located on a map |
+---------+-----------+---------------+---------------------------------+
| 3 | where is Germany located in Europe |
+---------+-----------+---------------+---------------------------------+
表格结果
+---------+-----------+---------------+---------------------------------+
| resu_id | result |
+---------+-----------+---------------+---------------------------------+
| 1 | Germany is located in Europe |
+---------+-----------+---------------+---------------------------------+
| 2 | Northern hemisphere in Europe |
+---------+-----------+---------------+---------------------------------+
| 3 | between France & Poland |
+---------+-----------+---------------+---------------------------------+
| 4 | Germany is located in central Europe |
+---------+-----------+---------------+---------------------------------+
| 5 | South of Denmark |
+---------+-----------+---------------+---------------------------------+
| 6 | 52 degrees North, 13 degrees East |
+---------+-----------+---------------+---------------------------------+
| 7 | located on the continent of Europe |
+---------+-----------+---------------+---------------------------------+
表点
+---------+-----------+-----------+-----------+
| pont_id | ques_id | resu_id | point |
+---------+-----------+-----------+-----------+
| 1 | 2 | 6 | 10 |
+---------+-----------+-----------+-----------+
| 2 | 1 | 1 | 8 |
+---------+-----------+-----------+-----------+
| 3 | 2 | 7 | 7 |
+---------+-----------+-----------+-----------+
| 4 | 3 | 5 | 9 |
+---------+-----------+-----------+-----------+
| 5 | 3 | 4 | 8 |
+---------+-----------+-----------+-----------+
| 6 | 1 | 7 | 10 |
+---------+-----------+-----------+-----------+
| 7 | 3 | 2 | 6 |
+---------+-----------+-----------+-----------+
| 8 | 2 | 3 | 4 |
+---------+-----------+-----------+-----------+
我尝试过了
SELECT resu_id FROM `Point` WHERE ques_id is (**?**) ORDER BY `point`
期待结果
+---------+-----------+-----------+--------------------------------------------+
| ques_id | resu_id | point | result |
+---------+-----------+-----------+--------------------------------------------+
| 1 | 7 | 10 | located on the continent of Europe |
+---------+-----------+-----------+--------------------------------------------+
| 1 | 1 | 8 | Germany is located in Europe |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 6 | 10 | 52 degrees North, 13 degrees East |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 7 | 7 | located on the continent of Europe |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 3 | 4 | between France & Poland |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 5 | 9 | South of Denmark |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 4 | 8 | Germany is located in central Europe |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 2 | 6 | Northern hemisphere in Europe |
+---------+-----------+-----------+--------------------------------------------+
按相关性对问题进行排序,然后根据分值对相应的结果进行排序。
谢谢大家的帮助,不要对我苛刻:)