• Great plugin, hit a snag with synonyms.

    Can I use phrase match for synonyms? Whatever I try doesn’t seem to work.

    bed side = bedside
    “bed side” = bedside
    ‘bed side’ = bedside
    bed+side = bedside
    bed + side = bedside
    bed AND side = bedside

    Is all returning bed results, when it should be showing me bedside tables.

    Any pointers much appreciated!

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

    (@msaari)

    What are your settings for the default operator and the fuzzy search?

    The correct format is simply

    bed side=bedside

    However, depending on what kind of search settings you have, this may not have much effect. If you have OR operator enabled and the synonym set, the search for bed side becomes bed side bedside, which will still match the bed results.

    Relevanssi Premium has a feature where you can index synonyms, making it possible to use synonyms with AND search. That might help in this case to reduce the garbage results.

    Thread Starter influxed

    (@influxed)

    Default operator is AND.

    Fuzzy search “When straight search gets no hits”.

    I tired disabling OR fallback but this had no effect.

    Plugin Author Mikko Saari

    (@msaari)

    If you have AND enabled, synonyms are simply not used. They are only used in OR searches (unless you have Premium, and enable indexing synonyms).

    Here’s one approach:

    add_filter('pre_get_posts', 'rlv_word_filter');
    function rlv_word_filter($query) {
        $query->query_vars['s'] = str_replace('bed side', 'bedside', $query->query_vars['s']);
    }

    Add this code to your theme functions.php file. Whenever someone searches for “bed side”, it is automatically transformed into “bedside”. If there are just few problem phrases, this approach works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Synonym phrase match’ is closed to new replies.