Skip to content

Commit 15be041

Browse files
committed
fix(server): remove stale and duplicate comments in semsearch queries
Remove a misleading "Simple example" comment on the production scoring logic and two duplicate "Re arrange rows" comments that restated the existing tie-break comment.
1 parent ac9d693 commit 15be041

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

server/backend/src/cq_server/semsearch/queries.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,12 @@ def combine(relevance, distance) -> float:
254254
float: Combined score computed as 0.8 * relevance + 0.2 * (normalized distance),
255255
where normalized distance is `distance / total_distance` or 0 when `total_distance` is 0.
256256
"""
257-
# Simple example: partially weighted over normalized distance
258257
relevance_weight = 0.8
259258
distance_weight = 0.2
260259
normalized_distance = distance / total_distance if total_distance > 0 else 0
261260
result = relevance * relevance_weight + normalized_distance * distance_weight
262261
return result
263262

264-
# Re arrange rows according to distance
265263
scored = [
266264
(
267265
combine(
@@ -281,6 +279,5 @@ def combine(relevance, distance) -> float:
281279
for u, distance in units
282280
]
283281
# Match RemoteStore tie-break: score desc, id desc on tie.
284-
# Re arrange rows according to distance
285282
scored.sort(key=lambda item: (item[0], item[1]), reverse=True)
286283
return [u for _, _, u in scored[:limit]]

0 commit comments

Comments
 (0)