Support » Plugin: Relevanssi - A Better Search » List the ACF fields that have been indexed?

  • Resolved bluedogranch

    (@bluedogranch)


    Is there a debug output or a way to list the ACF Pro fields that Relevanssi has indexed? Not repeater fields; these are “standard fields” in ACF.

    I’ve tried to index all ACF fields, or list the specific fields to be indexed, and in both cases I don’t see the contents of some ACF fields in search results; so I’m thinking something in my site functions or database is not letting Relevanssi index some fields.

    One issue might be that pages have a field called “body”, and posts, do too.

    Is there something in the wp_relevanssi table that will show all the fields that have been indexed?

    • This topic was modified 1 year, 4 months ago by bluedogranch.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    All custom field values are passed through the relevanssi_custom_field_value filter hook, and the parameters include the field name.

    If you add this to your theme functions.php:

    add_filter( 'relevanssi_custom_field_value', 'rlv_cf_debug', 10, 2 );
    function rlv_cf_debug( $value, $field ) {
        error_log( $field );
        return $value;
    }

    and then go save a post, your error log should have a list of all field names Relevanssi indexes.

    Thanks! That worked. I’m still not getting search results from some fields, and switching to WordPress default search doesn’t show them, either. I’ll look at it more and post another question.

    Plugin Author Mikko Saari

    (@msaari)

    What kind of content you have in those fields? If there are array structures or pretty much anything that isn’t just a string, Relevanssi may need some help.

    Thanks! It seems to be a unique situation; this was using Twig the PHP theme framework. After reading https://www.relevanssi.com/knowledge-base/query_posts/ I realized that there wasn’t a standard loop the search.php file; that file was preprocessing which fields were displayed on search-results.twig with its own loop.

    I did get Relevanssi to work and display keyword relevant results, rather than date relevant, and those results were pulled from ACF fields that had plain text and were indexed. And it is much better than the standard WP search.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List the ACF fields that have been indexed?’ is closed to new replies.