Skip to content

Prioritize exact search match #148

Closed

Description

@sandraa-nestor

When I'm searching with a couple of words I want objects with 2 or 3 words matching to be on the top of the list. Need to implement default sorting by best match or provide a search score in the output.

Activity

  1. dblock commented on Oct 18, 2026

    @dblock
    Contributor

    Implemented on master by #156 (planned for 0.6.0; not yet released). Enable Mongoid::Search.relevant_search = true, then call Model.full_text_search(query): results now expose a numeric relevance and are sorted highest-relevance-first. A real MongoDB regression searches for two words and verifies that the two-word match precedes the one-word match with scores [2, 1]. Ordinary search remains unchanged; scoring counts exact normalized keyword matches, rather than providing phrase-exactness or a separate exact-title boost. See UPGRADING.md.

    This comment was posted by an AI on behalf of @dblock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions