WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Relevanssi – A Better Search] Making Relevanssi better at multilanguage

[Plugin: Relevanssi – A Better Search] Making Relevanssi better at multilanguage

  • Hello.

    I installed the plugin on a multilanguage site with qtranslate. The problem was that the results returned were displayed in both languages, as qtranslate saves multiple language versions in the field by encapsulating them in specialized tags. For example a title field would hold <!--:lang1-->Lang1 title<!--:--><!--:lang2-->Lang2 title<!--:-->.

    Now this is a creates a problem when activating Relevanssi with highlighting turned on as the titles are stripped of their tags before highlighting them, which outputs search results as “Lang1 titleLang2 title”, for the example above.

    As simple fix for this would be to use the __() localization function.

    Transforming line 658 from:
    $post->post_title = strip_tags($post->post_title);
    to
    $post->post_title = strip_tags(__($post->post_title));
    would fix the problem.

    I hope you’ll consider adding this to the next update.
    Thank you for all your hard work on this plugin!

    http://wordpress.org/extend/plugins/relevanssi/

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

    @msaari

    Is that one occasion of the title the only place that needs fixing, or should I fix every place that accesses $post data? If it’s just that then the fix is trivial.

    That seems to be the only place that produces the issue with qtranslate since the title is stripped of the language tags.

    I haven’t tested your plugin exhaustively, and if I encounter other issues I’ll let you know. For now, that sole change will do a world of good.

    Thank you!

    Plugin Author Mikko Saari
    Participant

    @msaari

    Ok, consider it done.

    Oh, does this work:

    $post->post_title = strip_tags(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title));

    Because it would seem to be a better option (with, of course, a check to see if the function exists).

    qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage works great.

    Thank you again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] Making Relevanssi better at multilanguage’ is closed to new replies.