我有一个似乎无法弄清的错误。有人知道我在这里做错了吗?请假定图像的位置,主题,描述和测试在主题,位置或描述中多次出现。另外,我确实将ConText初始化参数TEXT_ENABLE设置为true。
SELECT 4*SCORE(1) + 2*SCORE(2) + SCORE(3) AS RANK FROM images i WHERE CONTAINS(i.subject, 'testing', 1)>0 OR CONTAINS(i.place, 'testing', 2)>0 OR CONTAINS(i.description, 'testing', 3)>0 ORDER BY RANK;
我设法通过用另一个查询包围当前查询并将ORDER BY RANK拉到外部查询来解决该问题。像这样:
SELECT * FROM (SELECT 4*SCORE(1) + 2*SCORE(2) + SCORE(3) AS RANK FROM images i WHERE CONTAINS(i.subject, 'testing', 1)>0 OR CONTAINS(i.place, 'testing', 2)>0 OR CONTAINS(i.description, 'testing', 3)>0) ORDER BY RANK;