WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Relevance not working unless category is supplied (10 posts)

  1. Steven Jones
    Member
    Posted 2 years ago #

    Hi,

    Website: http://calva.co/
    Search term: lorem

    By default my site searches by date. This is working fine.

    However if I search using relevance:
    http://calva.co/?s=lorem&orderby=relevance

    This does not work.

    However, if I include a category, then it does work.
    http://calva.co/?s=lorem&orderby=relevance&cat=4

    As you can see, the post with loads of lorem's appear in the last search.

    I have tried 'order=ASC' but that doesn't seem to be working.

    Any ideas?

    Cheers,
    Steve

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

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Are you sure you are getting results from Relevanssi in all cases? I don't know why the order by relevancy wouldn't work, because no matter what, the results are always created in order of relevancy and then sorted if something else is required.

  3. Steven Jones
    Member
    Posted 2 years ago #

    Have you looked at the examples on the site I am using?

    The only difference between the one that does work and the one that doesn't is I'm specifying a category. Now the reason why it's not working may be because of another reason, but I was wondering if anybody had any clues or something to try.

    Cheers,
    Steve

  4. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    I did take a look at them and that's why I asked.

  5. Steven Jones
    Member
    Posted 2 years ago #

    Would any of the settings have an impact on these results?

    Cheers,
    Steve

  6. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Hmm... you might want to try adding the relevancy score in the search results to see if that brings up something.

    So, check "Show breakdown of search hits in excerpts" and then put %score% in "The breakdown format". What kind of scores do you get when you have orderby=relevance all without the category and with the category?

  7. Steven Jones
    Member
    Posted 2 years ago #

    Ok so when there is a search without a category (the one where it fails)..

    http://calva.co/?s=lorem&submit=Go

    It's getting -0.32 for the posts with one occurrence and -10.57 for the one where lorem appears lots.

    If you do a search that includes a category then it's 53.52 for the one where it appears lots and 1.62 for the others.

    So it looks like without a category it's somehow making the results negative...

    Cheers,
    Steve

  8. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    That's odd, but it does show the relevancy ordering is working.

    I do have an idea: this just might be caused by having all posts with the same content. Try mixing things up a bit, change the contents of posts a bit so that every post isn't the same. That just might help.

  9. Steven Jones
    Member
    Posted 2 years ago #

    I've changed the content about a bit. Have a look at this search...

    http://calva.co/?s=windows&orderby=relevance

    Still producing negative numbers. If they can be removed then it'll be fixed, as the scores without the minus are correct.

    Cheers,
    Steve

  10. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    Your search form on the search results page is broken, by the way - you have two "s" input fields in it.

    Frankly, I don't know why the scores are negative. Looks like the search works otherwise, as the negative values are sorted in the right order.

    The problems might still be caused by the small number of posts in the database. At the moment I'd probably just wait and see if the problem persists once you start adding posts. If it doesn't go away, then you can start digging on the calculations to see where they go wrong.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags