Get results array for data indexed by wp solr

  • prakashreddy.imduri
    Participant
    5 months ago #30793

    Hi,
    Is there any code to echo the data indexed by wp solr plugin, to check the array and fields indexed for each product.

    wpsolr
    Keymaster
    5 months ago #30794

    Indeed:

    <?php
    use wpsolr\core\classes\WPSOLR_Events;
    
    add_filter( WPSOLR_Events::WPSOLR_FILTER_SOLARIUM_DOCUMENT_FOR_UPDATE, 'debug_indexed_data', 99, 5 );
    
    function debug_indexed_data( array $document_for_update, $solr_indexing_options, $post, $attachment_body, $search_engine_client ) {
     /* output $document_for_update here */
    
     return $document_for_update;
    }
    prakashreddy.imduri
    Participant
    5 months ago #30795

    I added code but not able to see any data. Where can I see the response, I just want to see this on search page for debugging, preferably in frontend …

    prakashreddy.imduri
    Participant
    5 months ago #30797

    Actually, I want the array to display some extra code in frontend.

    wpsolr
    Keymaster
    5 months ago #30798

    You can show the data in debug.log with error_log( print_r( $document_for_update, true ) );

    prakashreddy.imduri
    Participant
    5 months ago #30799

    Can’t I get the data for normal frontend use, without debug?

    prakashreddy.imduri
    Participant
    5 months ago #30800

    I mean the actual data with which wp solr is building the results, Can I access the array in frontend, to extend some lfunctionality?

    prakashreddy.imduri
    Participant
    5 months ago #30806

    Any variable or function to access data for results which the wp solr plugin is using, to add filters on it ?

    wpsolr
    Keymaster
    5 months ago #30807

    What would you like to achieve?

    prakashreddy.imduri
    Participant
    5 months ago #30808

    we added a custom date range filter, I need to get the count for the date ranges, so that we can hide the facet list item if count is zero.

    wpsolr
    Keymaster
    5 months ago #30809

    As mentioned on https://www.wpsolr.com/forums/topic/any-filter-for-custom-price-range-gap/, I cannot help on customizing WPSOLR with a new facet layout.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.