• Resolved hughc

    (@hughc)


    just a small thing, but I was alerted to broken search functionality by a client (no results returned). Examining the queries being executed, I noted the following sql query, which failed.

    
    SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 0 + relevanssi.comment * 0.1 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.2 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf 
    FROM wp_relevanssi AS relevanssi 
    WHERE relevanssi.term = 'search term here' 
    AND relevanssi.doc != 1175
    AND relevanssi.doc != 1234
    AND relevanssi.doc != 2006
    AND relevanssi.doc != 1232
    AND relevanssi.doc != 1151
    AND relevanssi.doc != 1681
    AND relevanssi.doc != 2001
    AND relevanssi.doc != 1675
    AND relevanssi.doc != 
    AND ( relevanssi.doc IN ( 
    SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts 
    WHERE posts.post_type IN ('directory-listing') ) )
    AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts 
    WHERE posts.post_status IN ('publish')))
    OR (doc = -1))
    ORDER BY tf DESC
    LIMIT 500
    

    There’s an empty exclusion there; it was caused by a trailing comma on the end of the exclusions field. Suggest this field value could be sanitised, lest it break all Relevanssi searches?
    cheers,
    Hugh

    • This topic was modified 6 years, 7 months ago by hughc.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘trailing comma in exclusions field breaks search’ is closed to new replies.