Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter gigplsm

    (@gigplsm)

    When the relevanssi_modify_wp_query filter is used the query returns 0 rows. So I removed that code once again and as before the query returns the correct 9 rows. The strange thing is that it now also sorts the results by the year-of-recording even though we did not use relevanssi_modify_wp_query to specify that field! When I removed that code the other day it did not sort properly. I did make an update today to the Elementor Pro plugin that we use and that’s the only thing that changed. The year-of-recording is the only numeric custom field being used so maybe it sorted that field by default? I guess I will leave well enough alone since it is working! Thanks for your help.

    Thread Starter gigplsm

    (@gigplsm)

    Just wanted to add to my last message that I was able to confirm that every post being searched does have content for year-of-recording.

    Thread Starter gigplsm

    (@gigplsm)

    Yes, I do get results if I remove the relevanssi_modify_wp_query filter. I’m certain all the posts that should be displayed for the text search “akiko” have content in the year-of-recording field. However, there are 200+ additional posts. Do I need to confirm that every one of those posts has content in that field?

    I installed the Query Monitor and the query section displayed this:

    SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
    FROM wpcn_relevanssi AS relevanssi
    INNER JOIN wpcn_postmeta
    ON ( relevanssi.doc = wpcn_postmeta.post_id )
    WHERE relevanssi.term = ‘akiko’
    AND ( wpcn_postmeta.meta_key = ‘year-of-recording’ )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wpcn_posts AS posts
    WHERE posts.post_type IN (‘discography’) ) )
    AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID)
    FROM wpcn_posts AS posts
    WHERE posts.post_status IN (‘publish’, ‘private’)))
    OR (doc = -1))
    ORDER BY tf DESC
    LIMIT 500

    SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
    FROM wpcn_relevanssi AS relevanssi
    INNER JOIN wpcn_postmeta
    ON ( relevanssi.doc = wpcn_postmeta.post_id )
    WHERE (relevanssi.term LIKE ‘akiko%’
    OR relevanssi.term_reverse LIKE CONCAT(REVERSE(‘akiko’), ‘%’))
    AND ( wpcn_postmeta.meta_key = ‘year-of-recording’ )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wpcn_posts AS posts
    WHERE posts.post_type IN (‘discography’) ) )
    AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID)
    FROM wpcn_posts AS posts
    WHERE posts.post_status IN (‘publish’, ‘private’)))
    OR (doc = -1))
    ORDER BY tf DESC
    LIMIT 500

    Thread Starter gigplsm

    (@gigplsm)

    Thanks for the quick response Mikko. When I copy/paste the code you provided into the functions.php and do a text search it yields no results and says “No items found”. There should have been 9 results for a search of “akiko” and I confirmed that those 9 entries all had content for year-of-recording, in case an empty field would have thrown things off. What could be causing the issue?

Viewing 4 replies - 1 through 4 (of 4 total)