WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
phrase synonym (14 posts)

  1. bheadrick
    Member
    Posted 1 year ago #

    is there any way to map a word to a phrase in synonyms - like you might use for acronyms?

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

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, just use the synonym tool in the settings.

  3. bheadrick
    Member
    Posted 1 year ago #

    adding synonyms with spaces in them doesn't seem to work.
    If I add the following to the synonyms list:
    dad=definitive audio designs
    and I do a search for "definitive audio designs" I get results, but if I do a search for DAD I get nothing.
    other synonyms are working.

  4. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    I just tested this, and it works just fine, even with a four-word phrase. I tried your example, and it works as expected.

    Do you have OR search enabled? Synonyms don't work at all, if you have AND search on.

  5. bheadrick
    Member
    Posted 1 year ago #

    Yes, I do have OR search enabled. other synonyms work. Do I need to reindex after updating the synonyms?

  6. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    No, you don't. Do other phrase synonyms work? Is 'dad' perhaps a stopword? What's your minimum word length?

  7. bheadrick
    Member
    Posted 1 year ago #

    No, I've tries other phrase synonyms, and none of them work.
    I lowered my minimum word length to 2.

    If you want to check out the site, it's at Showtime Car Audio

    Here's a screenshot of my settings

  8. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    How familiar are you with PHP? I've got no idea what's causing this since it works on my site, but if you're willing and able to help me with debugging this, we could dig out what's causing the problem.

  9. bheadrick
    Member
    Posted 1 year ago #

    Yeah, I'm great with PHP. Let me know what I need to do to debug.
    Thanks for your help!

  10. bheadrick
    Member
    Posted 1 year ago #

    ok, I just noticed there was an update, so I updated and my phrase synonyms seem to be working now, but it's not highlighting for synonyms.
    Is there any way to make it highlight synonym matches?
    Also, I'd prefer synonyms to have a higher priority than fuzzy search. in other words, if I search for "re cone" and there's a product that's labeled as a "recone kit" the whole word "recone" should be highlighted, and not just the "cone" part. Is any part of this doable?

  11. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Relevanssi should highlight synonym matches, at least it does so on my test blog.

    If you search for "re cone", Relevanssi won't highlight "recone", because it doesn't recognise the two as the same thing. There's no way it can, really, as it's fairly simple string matching engine that does the highlighting.

  12. bheadrick
    Member
    Posted 1 year ago #

    OK, I'm still seeing an issue with phrase relevance.
    After the 3.0.4 update, the "0 awg terminals" search doesn't produce an error, but the first result is "4 awg spade terminals" that literally doesn't have a "0" in the title, excerpt, or content.

    The second and third results ARE relevant to the search, but the other relevant results are further down in the results.

    There are results that only have the word "terminals" in the title ahead of other results that have "0 awg" and "terminals" in the title

    Does the position of the words in the phrase play a role in their weight in the search?

    I've reduced my minimum word length to 1, although that doesn't really seem like a good solution. What would be more useful is if certain phrases could be treated as a term - even if you had to define them manually.

    if you can do phrase synonyms, then this doesn't seem like it should be too much of a stretch.

    Is it possible to add some weight to custom taxonomies? The items I'm searching don't use categories and tags. (I've considered modifying the plugin to do that, but I'd really rather not)

  13. bheadrick
    Member
    Posted 1 year ago #

    ok, after a bit of messing with the settings, I'm starting to get much more relevant results.

    The phrase/term thing still might help somewhat. For example, it would make sense to treat "0 awg" or "0 gauge" as a single unit.

  14. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Unfortunately that's just not how Relevanssi works. Relevanssi can't treat phrases as a single unit, because Relevanssi operates on single words. Relevanssi index, which is used to calculate the weights, only has single words.

    Phrases have no effect in the weighting: Relevanssi just finds all posts with the phrase in it and uses that list of post IDs as a filter, removing all posts that don't have the phrase.

    Those single numbers are very tricky for searching. They can be very common, which means they will not have much weight in any case. Treating the phrase as an unit for weighting would be a good idea, but given currenct infrastructure of the search, it's not that simple.

    Of course, you can probably do a bit of a custom modification here. relevanssi_match filter hook gives you an object which contains a post ID (in $match->doc) and the weight (in $match->weight). Maybe you can use that to boost the weight of the relevant posts.

    You can adjust taxonomy weights in Relevanssi Premium.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic