• agamelas

    (@agamelas)


    Hello!
    Is there anyway to get the search order by the first word on the search bar?

    For instance I search: “ficha 3,5” and the results should order by the “ficha” word. Instead I

    Cabo 3,5 4 Pinos Macho / 2×3,5 Fêmea ST
    Ficha Alimentação DC Diâmetro Ø1,3×3,5×9,5mm Curta
    Ficha 3,5 Fêmea ST – Plástico (Blister 5 unid)
    Ficha Alimentação DC19V 5,5×3,0mm p/ Samsung ALM291/292
    Ficha 3,5 Fêmea 4 Pinos – Metal

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

    (@msaari)

    No, Relevanssi gives more weight to the term it considers more valuable, ie. which one is rarer in the database.

    There are some things that can be done here. It would be possible to for example reduce the value of numeric search terms.

    add_filter( 'relevanssi_match', 'rlv_numeric_unboost' );
    function rlv_numeric_unboost( $match ) {
        if ( is_numeric( substr( $match->term, 0, 1 ) ) ) {
            $match->weight *= 0.1;
        }
        return $match;
    }

    Adding this to your theme functions.php would make search term matches that begin with a number rank lower.

    Thread Starter agamelas

    (@agamelas)

    thanks but still not working… the expected results when looking for “ficha 3,5” are only on second page…
    if I have more weight on title and the term on title is exactly FICHA 3,5 it should appear as first results…

    Plugin Author Mikko Saari

    (@msaari)

    Before going any further, I’d check if the results are ordered by relevance in the first place. If you do the same search on the Relevanssi admin search (Dashboard > Admin search), what order are the results in, and what kind of weights do these posts get?

    Thread Starter agamelas

    (@agamelas)

    hi!
    – i have “Relevance” chosen.
    – in admin it gives me totally different order but still not the one I wish.
    – i have partial words
    – weight all with 1 and title with 50
    – also have the snippet to keep punctuation

    Plugin Author Mikko Saari

    (@msaari)

    You can try this snippet for boosting beginning of the title matches: https://www.relevanssi.com/knowledge-base/relevanssi-match/#titlebeginning

    Thread Starter agamelas

    (@agamelas)

    thank you so much!!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Search order results’ is closed to new replies.