Skip to content

Commit be94263

Browse files
committed
docs(internal): qualify the graph-hit score impossibility claim
The comment said no value of _GRAPH_HIT_SCORE makes fuzzy mode symmetric, and rested that on _calculate_entity_score having no ceiling. The absent clamp does not carry the claim: that score is a sum of bounded parts, so a large enough constant would dominate it. What actually rules such a constant out is the exact-mode property the paragraph above asserts - every survivor scores 100 there, and raising the constant breaks that tie. Name the condition instead of leaving it implicit.
1 parent e9b8244 commit be94263

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/ha_mcp/tools/smart_search/_graph.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,15 @@ async def fetch_related_buckets(client: Any, entity_id: str) -> GraphResult | No
359359
# two 0-or-100 signals against a threshold of 100), so a graph hit sorts
360360
# indistinguishably from a body hit.
361361
#
362-
# Fuzzy mode is not symmetric, and no value here makes it so: the 100 cap
363-
# belongs to the config-body score (``_search_in_dict``), while the NAME score
364-
# from ``_calculate_entity_score`` accumulates without a ceiling — a name
365-
# echoing the queried entity's words can pass 100 on its own. So with
366-
# ``exact_match=False`` a graph-ONLY hit (``_merge_graph_hits`` leaves an
367-
# already-scored record's score alone) can sort below a match that merely
368-
# resembles the query, and land on a later page under a small ``limit``. It is
369-
# still counted in ``total_matches`` unless visibility enforcement scrubs it.
362+
# Fuzzy mode is not symmetric, and no value here makes it so without breaking
363+
# the tie above: the 100 cap belongs to the config-body score
364+
# (``_search_in_dict``), while the NAME score from ``_calculate_entity_score``
365+
# accumulates without a ceiling — a name echoing the queried entity's words can
366+
# pass 100 on its own. So with ``exact_match=False`` a graph-ONLY hit
367+
# (``_merge_graph_hits`` leaves an already-scored record's score alone) can sort
368+
# below a match that merely resembles the query, and land on a later page under
369+
# a small ``limit``. It is still counted in ``total_matches`` unless visibility
370+
# enforcement scrubs it.
370371
_GRAPH_HIT_SCORE = 100
371372

372373

0 commit comments

Comments
 (0)