• Resolved JD

    (@jutta0303)


    Hi, I noticed today on my site using Relevanssi, that when I search for a phrase that includes an apostrophe in a word, wrapped in quotes, Relevanssi yields no search results.

    For example I know this phrase exists on my site: “the world’s thinking”

    There are two different scenarios that happen:
    1.) I type this into the search bar: “the world’s thinking” (including the double quotes and a “straight” apostrophe) — my results are shown, however the actual search phrase is not shown in the excerpt; it’s just showing the first paragraph of the page containing the search phrase.

    2.) I copy the actual phrase from the page that includes the phrase and paste it into the search bar: “the world’s thinking” (note, that this makes the apostrophe “curly” instead of straight) — my search results in this case are, “No Results Found.”

    Can you tell me what’s happening here? Why is this not working? The search function works PERFECTLY for terms and phrases that do not include an apostrophe (both, scenario 1 and 2 yield proper results for non-apostrophized terms/phrases with the search terms/phrases bolded in the search result excerpts).

    https://www.ads-software.com/plugins/relevanssi/

Viewing 4 replies - 16 through 19 (of 19 total)
  • Plugin Author Mikko Saari

    (@msaari)

    No, that doesn’t work. The synonyms don’t apply in the phrase search.

    But good to hear that the suggested fix works; I’ll make sure to include that in the next version.

    Thread Starter JD

    (@jutta0303)

    So cool! Thank you so much!!

    Hi Guys,

    I found a solution. Use the following statements any one them in your search term.

    $search_term = esc_js($search_term);
    (OR)
    $search_term = esc_attr($search_term);
    (OR)
    $search_term = json_encode($search_term);

    Thanks
    Srikanth

    Thread Starter JD

    (@jutta0303)

    Hi Srikanth,

    Can you explain what your code’s function is in detail?

    Thank you!

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Searches including apostrophes yield no results’ is closed to new replies.