dragonflydb / dragonflydb/dragonfly

Support WITHSCORES/SCORER in cluster search (CSS) mode

Open
#7,182 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
31.5k
Forks
1.3k
Avg merge
1d 10h
Merged PRs (30d)
137

Description

Problem:

FT.SEARCH with WITHSCORES/SCORER is currently blocked in cluster search (CSS) mode with an error:

`WITHSCORES/SCORER is not yet supported in cluster search mode`

The coordinator-side reply parser in `FtSearchCSS` expects each hit as `[key, [sortkey], [fields...]]`, but WITHSCORES adds an extra score element `[key, score, [sortkey], [fields...]]` which misaligns parsing and produces errors.

Blocked in #7181.

Required changes:
1. **CSS reply parser**: when `params.with_scores` is set, consume the score string after the key and populate `SerializedSearchDoc::text_score`
2. **Score merging**: when collecting results from multiple shards, scores from different shards use per-shard statistics. Consider whether cross-shard score normalization is needed or if per-shard scores are acceptable for ranking
3. **SCORER forwarding**: ensure the SCORER parameter is forwarded to remote shards in the CSS command string
4. **Remove the guard** added in #7181 once the above is implemented

Contributor guide

Open the contributing guide

Research direction

Start with the coordinator-side FtSearchCSS reply parser and SerializedSearchDoc::text_score, then inspect the CSS command construction and the guard added in #7181. Verify that WITHSCORES parses correctly across shard replies, SCORER reaches remote shards, score merging is handled appropriately, and the unsupported-mode guard is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases, distributed-systems, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.