• Hi,

    I’ve been trying to make Relevanssi work with Search & Filter plugin and seems impossible.

    I run all tests as described here: https://www.relevanssi.com/knowledge-base/debugging-relevanssi-searching-issues/ and I can see the query and arrays with data:

    For example, third test, gives:

    array(51) { [553332]=> float(6595.5969933514) [571966]=> float(5073.5361487319) [373469]=> float(5073.5361487319) [575758]=> float(3551.4753041123) [568277]=> float(4058.8289189855) [425304]=> float(3551.4753041123) [395367]=> float(3551.4753041123) [373487]=> float(608.82433784782) [147481]=> float(3551.4753041123) [118902]=> float(3551.4753041123) [635830]=> float(3044.1216892391) [567456]=> float(101.47072297464) [519516]=> float(3044.1216892391) [493536]=> float(2536.7680743659) [412428]=> float(3044.1216892391) [387703]=> float(2536.7680743659) [371739]=> float(3044.1216892391) [361103]=> float(2536.7680743659) [288141]=> float(3044.1216892391) [286966]=> float(3044.1216892391) [599421]=> float(2536.7680743659) [251647]=> float(3044.1216892391) [7500]=> float(3551.4753041123) [617543]=> float(304.41216892391) [445000]=> float(2536.7680743659) [383720]=> float(202.94144594927) [213415]=> float(2536.7680743659) [405348]=> float(101.47072297464) [434736]=> float(101.47072297464) [372488]=> float(202.94144594927) [147451]=> float(101.47072297464) [147429]=> float(101.47072297464) [135108]=> float(507.35361487319) [564108]=> float(202.94144594927) [545823]=> float(101.47072297464) [373650]=> float(507.35361487319) [304744]=> float(101.47072297464) [200833]=> float(101.47072297464) [119780]=> float(101.47072297464) [98721]=> float(101.47072297464) [519486]=> float(101.47072297464) [396646]=> float(101.47072297464) [304739]=> float(101.47072297464) [304710]=> float(101.47072297464) [212403]=> float(101.47072297464) [166003]=> float(101.47072297464) [165924]=> float(101.47072297464) [165863]=> float(101.47072297464) [165736]=> float(101.47072297464) [48910]=> float(101.47072297464) [17192]=> float(101.47072297464) }.

    But there is no way I can see the list of posts after searching, I also tried “var_dump( $posts ); exit();” in lib/search.php and I still get “not post founds”.

    I appreciate your help, buy looking in the SQL results the posts the search is retrieving it looks exactly what we expect, but now we need to show them in our result page. We are using Marketify theme, maybe something is blocking results to be rendered.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Since Marketify is a premium theme, I have no idea of its inner workings.

    So var_dump( $posts ); in the Relevanssi code returns nothing?

    Does this show you a list of results?

    add_filter( 'relevanssi_hits_filter', 'rlv_check_hits' );
    function rlv_check_hits( $results ) {
        var_dump( $results[0] );
        exit();
    }

    Have you tried removing Search & Filter from the equation?

    Thread Starter alvarokid

    (@alvarokid)

    So var_dump( $posts ); in the Relevanssi code returns nothing?

    Nothing.

    Does this show you a list of results?

    add_filter( ‘relevanssi_hits_filter’, ‘rlv_check_hits’ );
    function rlv_check_hits( $results ) {
    var_dump( $results[0] );
    exit();
    }

    Yes, I get this:

    array(52) { [0]=> int(553332) [1]=> int(571966) [2]=> int(373469) [3]=> int(568277) [4]=> int(575758) [5]=> int(425304) [6]=> int(395367) [7]=> int(147481) [8]=> int(118902) [9]=> int(7500) [10]=> int(251647) [11]=> int(286966) [12]=> int(288141) [13]=> int(371739) [14]=> int(412428) [15]=> int(519516) [16]=> int(635830) [17]=> int(599421) [18]=> int(493536) [19]=> int(445000) [20]=> int(387703) [21]=> int(361103) [22]=> int(213415) [23]=> int(373487) [24]=> int(373650) [25]=> int(135108) [26]=> int(617543) [27]=> int(383720) [28]=> int(372488) [29]=> int(564108) [30]=> int(567456) [31]=> int(165924) [32]=> int(17192) [33]=> int(48910) [34]=> int(98721) [35]=> int(119780) [36]=> int(147429) [37]=> int(147451) [38]=> int(165736) [39]=> int(165863) [40]=> int(166003) [41]=> int(545823) [42]=> int(200833) [43]=> int(212403) [44]=> int(304710) [45]=> int(304739) [46]=> int(304744) [47]=> int(396646) [48]=> int(405348) [49]=> int(434736) [50]=> int(519486) [51]=> int(50070) }

    Have you tried removing Search & Filter from the equation?

    Yes, and it doesn’t work either with native theme search.

    I get “No Downloads found”.

    Any ideas on how to find a solution for this?

    Thank you.

    Plugin Author Mikko Saari

    (@msaari)

    So if relevanssi_hits_filter finds stuff, but relevanssi_do_query returns an empty array, then there aren’t many possible places where things can go wrong.

    After relevanssi_hits_filter, Relevanssi checks which posts it should return, based on paged and posts_per_page query variables. Those set the high and low boundary and Relevanssi fetches all posts between those. If you, for example, set the posts_per_page to 0, then you won’t get any posts. Could this be the cause of the problem?

    So check the query variables: are they making sense?

    Thread Starter alvarokid

    (@alvarokid)

    Sorry but I didn’t get it. Could you please me suggest me the changes I should do and in which files to try?

    I can also give you credentials if needed.

    Thank you.

    Thread Starter alvarokid

    (@alvarokid)

    I understood what you meant, but searching without relevanssi is fetching posts, so even Marketify or Search & Filter should be setting paged or posts_per_age correctly. May be the problem is how Relevanssi is parsing the array into results there or maybe an exception that terminates the function before letting the result page render results. But it seems either Search & Results or Marketify theme (both searches works ok alone and together) are not understanding what Relevanssi is returning.

    Is there any way to debug this? Let me know.

    Plugin Author Mikko Saari

    (@msaari)

    And yeah, actually, you can’t set posts_per_page to 0, because Relevanssi would automatically correct that to -1, because otherwise you’d get a division by zero error.

    There’s a plenty you can do to debug this. Look at relevanssi_do_query(). On line

    $hits_filters_applied = apply_filters( 'relevanssi_hits_filter', $filter_data );

    everything should be fine, if relevanssi_hits_filter shows the correct set of results.

    In the end, $query->posts = $posts; seems to not have the correct results, if the var_dump( $posts ); is showing an empty array.

    So, take a look at the process from the relevanssi_hits_filter to the end of the function, and see where the results are lost. Between those two parts, all Relevanssi does is to do the paging: relevanssi_hits_filter has all the results, and the function should only return those results the current search results page should show.

    You can see, for example, the values of $search_high_boundary and $search_low_boundary. Do they make sense? If they do, there should be no problems, so it’s likely something’s off there. So what is wrong with them?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Search showing zero results’ is closed to new replies.