• Hey Mikko,

    I have set the Minimum word length option, but it does not seem to be working. I tried adding the code suggested, but still it does not work.
    Would appreciate your help here

    Ruth

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

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

    (@msaari)

    Searching for two-letter words seem to work fine (I searched for “את” and that found many posts). One-letter words require special handling. Have you added those functions?

    add_filter( 'relevanssi_block_one_letter_searches', '__return_false' );
    add_filter( 'relevanssi_allow_one_letter_highlights', '__return_true' );

    That kind of “9 (b)” searches are tricky, and even in the best case generally not very helpful. If that’s something you want to search for, adjust the punctuation removal so that the search looks for “(b)” with the parentheses, and not just “b”, because that will return each and every post that has a word that begins with “b”. That’s not helpful.

    It would be even better to fix those kinds of search terms to be more precise so that they are indexed and searched for as “9(b)” or something like that; that way you don’t have to index all one-letter words, which is generally quite wasteful, and you would have more precise results.

    There was a recent case where someone wanted to search for identifiers like that: https://wordpress.org/support/topic/search-for-exact-multi-part-strings/

    Thread Starter ruth22

    (@ruth22)

    Hello,
    I understand what you mean but the regex in the attached thread is fairly complicated, would you be willing to guide me on that?
    Do I need to use the same filters? What would be a good regex search for this type of text like “9b” or “9(b)”
    Thanks ,
    Ruth

    Plugin Author Mikko Saari

    (@msaari)

    For simple cases like that, you’ll do fine just by removing the parentheses:

    add_filter( 'relevanssi_punctuation_filter', 'rlv_no_parentheses' );
    function rlv_no_parentheses( $replacements ) {
      $replacements['('] = '';
      $replacements[')'] = '';
      return $replacements;
    }

    Add this to your theme functions.php and rebuild the index.

    Thread Starter ruth22

    (@ruth22)

    Hello again,
    I’ve added the code you provided and rebuilt the index, I’m searching for 9(ב) but still don’t see all of the results. e.g.
    Here is a post that has the text 9(ב): https://prnt.sc/1y1ru97
    Here are the actual search results: https://prnt.sc/1y1rvxq

    That post doesn’t appear in the search results. What should I do?

    Thanks
    Ruth

    Plugin Author Mikko Saari

    (@msaari)

    If you look at the post that doesn’t appear in the search results with the Relevanssi debugger (Settings > Relevanssi > Debugging), there should be “9ב” in the post content. Is there? If not, check that the minimum word length is 2.

    I tested this on my test site using your page content, and it worked, so I’m not sure what’s the problem on your site.

    Thread Starter ruth22

    (@ruth22)

    Hello again,
    I’ve made a video for you showing all the plugins options and the check that I’ve made. Here’s the link: https://www.loom.com/share/ade225b38d0a4ea6a621e7290187791a

    The post content does not show 9(ב) but it does appear on the frontend
    Thanks
    Ruth

    Plugin Author Mikko Saari

    (@msaari)

    I’m sorry, but I don’t know. It may be Elementor is part of this. What if you try copying the 10.1 paragraph from the post to a new post, without using Elementor, and saving the post. Does the indexing work correctly then?

    Thread Starter ruth22

    (@ruth22)

    I have just created this new page: https://prnt.sc/1y58o88
    Then I rebuilt the index: https://prnt.sc/1y58q83
    Then I cleared cache and went to search for 9(ב)
    The post appears in the search results: https://prnt.sc/1y58t1k

    It does seem that Elementor content is not being indexed well then, would you mind testing this yourself?

    Plugin Author Mikko Saari

    (@msaari)

    How would I reproduce your site in Elementor? What kind of content is that? Assume I know nothing about Elementor.

    Thread Starter ruth22

    (@ruth22)

    Would giving yo access to my site help?
    Basically it’s a comprehensive guide regarding freedom of information and transparency in Israel.
    I guess the content itself doesn’t really matter as long as searching for a content such as 9(b) would show the posts that contain that phrase.
    Elementor is a page builder, I don’t see how that would effect anything because if you’re using the_content filter you should see still be able to see the content with or without Elementor
    You can create a few pages and a search results page, all you have to do is create a page, edit it with elementor and insert the content in a text widget
    Thanks,
    Ruth

    Plugin Author Mikko Saari

    (@msaari)

    I tested this on Elementor with your content and the code I gave you, and it just works, exactly as it should. So sorry, I don’t know why it’s not working on your site.

    Please do not provide access to your site; I’m not allowed to ask for that on these forums, and it’s a service I can only provide to Relevanssi Premium customers anyway.

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

The topic ‘short search terms’ is closed to new replies.