0

我需要在全文搜索中对结果进行排序。这是我的代码

'SELECT presentations.id, ' +
        'presentations.72_png , ' +
        'presentations.topic_id, ' +
        'presentations.name, ' +
        'presentations.presenter_id , ' +
        'presentations.synopsis , ' +
        'presentations.tags , ' +
        'presentations.teaching_guide_text , ' +
        'presentations.video_type, ' +
        'presenters. first_name, ' +
        'presenters.last_name, ' +
        'presenters.title, ' +
        'presenters.company, ' +
        'MATCH (presentations.name) AGAINST (%s) AS rel1 ,' +
        'MATCH (presentations.synopsis) AGAINST (%s) AS rel2,' +
        'MATCH (presentations.tags) AGAINST (%s) AS rel3,' +
        'MATCH (presentations.teaching_guide_text) AGAINST (%s) AS rel4,' +
        'MATCH (presenters.first_name,presenters.last_name) AGAINST (%s) AS rel5 ,' +
        'MATCH (presenters.title) AGAINST (%s) AS rel6 ,' +
        'MATCH (presenters.company) AGAINST (%s) AS rel7 , ' +
        'MATCH(presentations.search_leadership) AGAINST (%s) AS rel8 ,' +
        'MATCH(presentations.search_business) AGAINST (%s) AS rel9 ,' +
        'MATCH(presentations.search_academic) AGAINST (%s) AS rel10 ,' +
        'MATCH(presentations.search_industry) AGAINST (%s) AS rel11 ' +
        'FROM presentations ' +
        'INNER JOIN presenters ON ' +
        '(presentations.presenter_id = presenters.id) ' +
        'WHERE presentations.deleted=0 AND ' +
        'presentations.published=1 AND ' +
        '(MATCH (presentations.name, ' +
        'presentations.synopsis , ' +
        'presentations.tags , ' +
        'presentations.teaching_guide_text) AGAINST (%s) OR ' +
        'MATCH (presenters.first_name , ' +
        'presenters.last_name , ' +
        'presenters.title , ' +
        'presenters.company) AGAINST (%s) OR ' +
        'MATCH (presentations.search_leadership, ' +
        'presentations.search_business , ' +
        'presentations.search_academic , ' +
        'presentations.search_industry) AGAINST (%s)) AND ' +
        'academic_only = 0 ' +
        'ORDER BY   (rel6 * 1000)+ (rel7 * 1000) + (rel8 * 90) + (rel9 * 80) + (rel10 * 70) + (rel11 * 60)  DESC ',
         [word, word, word, word, word, word, word, word, word, word,
 word, word, word, word, ])

这段代码没有给我排序顺序。如果我删除“ 'ORDER BY (rel6 * 1000)+ (rel7 * 1000) + (rel8 * 90) + (rel9 * 80) + (rel10 * 70) + (rel11 * 60) DESC '”,它也会给出与以前相同的结果。我的 SQL 代码有什么问题?

4

0 回答 0