Boost pages over media (PDFs)

  • DarrenPotter
    Participant
    # 1 month, 3 weeks ago

    Hi,

    PDFs are dominating my search results a little too much. Can I use type to boost pages or give media files less weighting? If so, how do I do that?

    Darren

    wpsolr
    Keymaster
    # 1 month, 3 weeks ago

    Of course, yes.

    Use boost values on field “type” like:
    attachment^.5
    page^1

    (tested on my local env)

    DarrenPotter
    Participant
    # 1 month, 3 weeks ago

    Thanks for the reply. I tried it exactly as you showed it but the search broke and I got the following message:

    Solr HTTP error: OK (400) {“error”:{“metadata”:[“error-class”,”org.apache.solr.common.SolrException”,”root-error-class”,”org.apache.solr.parser.TokenMgrError”],”msg”:”org.apache.solr.search.SyntaxError: Cannot parse ‘type:\”attachment\”^.5 type:\”page\”^1’: Lexical error at line 1, column 19. Encountered: \”.\” (46), after : \”\””,”code”:400}}

    wpsolr
    Keymaster
    # 1 month, 3 weeks ago

    Which Solr version is it?

    Can you try:
    attachment^1
    page^2

    DarrenPotter
    Participant
    # 1 month, 3 weeks ago

    It’s WPSOLR PRO 19.5.

    I tried those values. The search didn’t break this time but I’m not seeing any difference, even when I tried some pretty extreme boosts e.g.

    attachment^1
    page^3000

    wpsolr
    Keymaster
    # 1 month, 3 weeks ago

    Your Apache Solr version?

    wpsolr
    Keymaster
    # 1 month, 3 weeks ago

    Mea culpa, I made my previous tests with Elasticsearch.

    So, now with Solr, I confirm that partial decimals notation like “.5” crashes. One need to use “0.5”

    So, the previous example should have been (for Solr):

    attachment^0.5
    page^1

    But then, on my local env, the boosts work as expected, and PDFs are displayed after pages in results.

    wpsolr
    Keymaster
    # 1 month, 3 weeks ago

    WPSOLR PRO 19.5 is very old. Please update it, your issue could have been fixed in later versions.

    DarrenPotter
    Participant
    # 1 month, 3 weeks ago

    Thanks for the quick replies; I’ve managed to improve the results. Will look into upgrading!

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.