• Resolved problematichild

    (@problematichild)


    Hi, I would like to ask for assistance regarding product not returning in search result.

    We have Relevanssi – A Better Search and Relevanssi Live Ajax Search installed on our site.

    Previously when I try to search 14% it will not return any result even though we have one product with 14% on the title. I modified the minimum word length to 2 and the product is now displaying on top of search results https://prnt.sc/5aX5H4cjifJz

    Now, here’s our problem. We have a product named Philips Zoom Day White 14% and Philips Zoom Nite White 16% and when I try to search philips 16% it will return the Philips Zoom Nite White 16% product on top of search result https://prnt.sc/qcusadXIMfDm but when I try to search for philips 14% it will not display on top of search result https://prnt.sc/DTBr5PaB0goZ where it should display on the top just like when I try to search 14% only because it’s the only product with 14% on the title.

    How can we make the result display the most relevant product first? We set default order to relevance https://prnt.sc/6K92NkEKw3-j and I’m not sure what I’m missing.

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

    (@msaari)

    First of all, a good improvement would be to keep the % symbol intact. Now, it’s being removed (which is why you had to set the minimum word length to 2).

    Add these to your site:

    add_filter('relevanssi_remove_punctuation', 'rlv_keep_percent_1', 9);
    function rlv_keep_percent_1($a) {
    	$a = str_replace( '%', 'PERCENTSYMBOL', $a );
    	return $a;
    }
     
    add_filter('relevanssi_remove_punctuation', 'rlv_keep_percent_2', 11);
    function rlv_keep_percent_2($a) {
    	$a = str_replace('PERCENTSYMBOL', '%', $a);
    	return $a;
    }

    These can go to the theme functions.php or in a code snippet. Then rebuild the index. Does this solve the problem?

    Thread Starter problematichild

    (@problematichild)

    Hi @msaari I added the filters on the theme functions.php, rebuilt the index and cleared all the cache. However, the product won’t still display on top. It’s the only product with 14% on the title so we are hoping this would display first and if not first at least it should show on the live search dropdown. Is there any other things we can do about it?

    Plugin Author Mikko Saari

    (@msaari)

    If you check the product with the Relevanssi debugger (Settings > Relevanssi > Debugging), does the title now include the % symbol?

    Thread Starter problematichild

    (@problematichild)

    This the result when I tried to debug the product https://prnt.sc/r0BusGB58ESU the title includes the % sybmol

    Plugin Author Mikko Saari

    (@msaari)

    Ah, the answer is simple: you’re searching for “philips”, but the post title has “phillips”. Fix the post title to have “philips”, and it’ll work better.

    Thread Starter problematichild

    (@problematichild)

    These are the searches that I tried
    14% – shows on top https://prnt.sc/NrGy4IaJ4dG6
    philips 14% – not showing on live results https://prnt.sc/aV2avH-ruT43
    philips zoom 14% – shows on top https://prnt.sc/ARkaCyrbFjpT

    when I tried to search other products like philips 16%, it is showing on top https://prnt.sc/e2g6UVzPiMXl unlike 14%

    Thread Starter problematichild

    (@problematichild)

    Ohh, I missed that. You have a keen eye for details! I’ll try to update it now. Thank you so much for your help. I really appreciate it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Product not displaying on top of search result’ is closed to new replies.