• Resolved d19cannon

    (@d19cannon)


    Hi Mikko.

    I had a quick question regarding the searching method that is used in this plugin.

    If you try the following searches in the page that is linked in this message. You’ll see that when you search e.g. a product called “L45H” that you will have find result. However, when I am trying to search with just “45” it will not return the expected post as in the previous search.

    The problem for us is that there are quite a few products with some model numbers like the ’45’ and ‘200’ etc.

    I checked the configurations and the everything is currently index (all post types., pages etc) and the minimum search input is 1 (also tried 2).

    From the documentation I tried to debug it without any success.

    Let me know if you have an alternative ideas?

    Kind regards,
    -Dan

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

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

    (@msaari)

    The problem is that Relevanssi doesn’t search inside words. “L45H” can be found with “L45” or “45H”, but not with just “45”?– that’s generally a good thing, as in-word matches will increase the number of garbage results.

    If you look at the Relevanssi help panel (click Help on the top right corner of Relevanssi settings pages in your WP admin dashboard), you’ll find a way to have Relevanssi match inside words there. If you do that, increase the minimum word length to 2, having inside-word matching and word length of 1 is a disaster.

    Thread Starter d19cannon

    (@d19cannon)

    Quick update how the query looks like

    
    string(714) "SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 +
    				relevanssi.content * 5 + relevanssi.comment * 0.75 +
    				relevanssi.tag * 1 + relevanssi.link * 0.75 +
    				relevanssi.author + relevanssi.category * 1 + relevanssi.excerpt +
    				relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
    				FROM wp_relevanssi AS relevanssi  WHERE  relevanssi.term = '45'   AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts
    			WHERE posts.post_type NOT IN ('revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'acf-field-group', 'acf-field', 'smart-services', 'archive', 'faq'))) OR (doc = -1)) ORDER BY tf DESC LIMIT 500"
    
    Plugin Author Mikko Saari

    (@msaari)

    WHERE relevanssi.term = '45' is not good, WHERE relevanssi.term LIKE '%45%' is what you’d need.

    Thread Starter d19cannon

    (@d19cannon)

    Yeah, I understand that the length should be greater than 1, however, I am trying to get any other alternative results.

    Thank you for you input! I will keep you posted about the results.

    Plugin Author Mikko Saari

    (@msaari)

    Did you find the instructions in the Relevanssi help menu?

    Thread Starter d19cannon

    (@d19cannon)

    I did and I added the following in functions.php

    
    add_filter("relevanssi_fuzzy_query", "rlv_partial_inside_words");
    function rlv_partial_inside_words($query) {
        return "(term LIKE '%#term#%')"; 
    }
    

    Without success

    • This reply was modified 4 years, 5 months ago by d19cannon.
    Plugin Author Mikko Saari

    (@msaari)

    Set the Relevanssi keyword matching setting to “partial matching”.

    Thread Starter d19cannon

    (@d19cannon)

    It works! You’re an absolute life saver.
    Thank you for you help ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can’t match topics search with only digits’ is closed to new replies.