• Resolved ChrisLomax

    (@chrislomax)


    Hi, there is a point in class-wp-solr that calls an apply_filters function that doesn’t seem to exist.

    It in turn converts the array of Custom Fields into a count of fields and then there isn’t a lookup available. Commenting out $custom_fields = apply_filters( WpSolrFilters::WPSOLR_FILTER_POST_CUSTOM_FIELDS, $post->ID, $custom_fields ); seems to solve the issue but I don’t know what it’s meant to call.

    https://www.ads-software.com/plugins/wpsolr-search-engine/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPSolr free

    (@wpsolr)

    WPSOLR filters are defined as constants in wpsolr-filters.php.

    Here is the definition of this filter:

    // Customize a post custom fields before they are processed in a Solarium update document
    const WPSOLR_FILTER_POST_CUSTOM_FIELDS = 'wpsolr_filter_post_custom_fields';

    An example of how it’s used is in the s2member plugin extension file wpsolr-s2member.php:

    add_filter( WpSolrFilters::WPSOLR_FILTER_POST_CUSTOM_FIELDS, array(
    			$this,
    			'filter_custom_fields'
    		), 10, 2 );

    I’m happy to say that we will extend WPSOLR to be much more customizable in themes page templates. You can follow/contribute the ticket https://www.ads-software.com/support/topic/needed-mechanism-for-users-to-create-their-custom-templates

    Thread Starter ChrisLomax

    (@chrislomax)

    When this filter is applied though it turns the array of custom fields into a numeric figure.

    It seems whatever filter is being applied and returned is collapsing the array into an int.

    I have the groups plugin extension installed working too, is there a chance that the groups extension is flattening the array into an int?

    I can see the constant registered, the issue is the filter itself, it’s flattening the array to an int

    Plugin Author WPSolr free

    (@wpsolr)

    Exact, it’s a stupid argument inversion. Should be:

    $custom_fields = apply_filters( WpSolrFilters::WPSOLR_FILTER_POST_CUSTOM_FIELDS, $custom_fields, $post->ID );

    Can you test it ?

    Thread Starter ChrisLomax

    (@chrislomax)

    Perfect, that seems to have resolved it

    Thanks

    Plugin Author WPSolr free

    (@wpsolr)

    I updated WPSOLR 3.1 with this fix.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom fields not being sent to Solr’ is closed to new replies.