Skip to content

Add backend tag boost for search without hard tag filtering #51

Description

@bernoussama

Problem

Agents should be able to provide tags as first-class search context, but simply concatenating tags into the search query can make keyword search worse. For example, appending typescript monorepo to a precise query like TS2307 pnpm may over-constrain websearch_to_tsquery and miss otherwise relevant results that match the error/package but not every tag.

Proposed approach

Keep query and tags separate in the API/search layer, then use tag overlap as a ranking boost instead of a required match.

Desired behavior:

  • query remains the primary retrieval signal.
  • tags are optional relevance hints.
  • Results with overlapping tags rank higher.
  • Results without tag overlap can still appear when they match the query well.
  • No hard filtering unless explicitly added as a separate future option.

Implementation notes

  • Extend search inputs to accept optional tags separately from query.
  • Normalize tags consistently across stored solutions and input hints.
  • For keyword search, add ranking boost for tag overlap without adding tag terms to the tsquery in a way that requires them.
  • For hybrid/semantic search, preserve the query embedding behavior and apply tag overlap as a post-retrieval rerank signal.
  • Update MCP search_solutions only after backend support exists, so agents can pass tags without degrading keyword recall.

Acceptance criteria

  • Searching TS2307 pnpm with tags like typescript,monorepo does not lose strong TS2307 pnpm matches that lack one of those tags.
  • Results with matching tags are ranked above similar-scoring results without matching tags.
  • MCP/API docs describe tags as optional relevance hints, not strict filters.
  • Tests cover keyword search with tags, tag-overlap reranking, and no-result regressions from over-constrained tag terms.

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions