Skip to content

search --type bm25 fails on tables with a column named score (duplicate relevance column) #179

Description

@eddietejeda

Summary

hotdata search --type bm25 fails when the target table has a user column named score, because the BM25 relevance column emitted by bm25_search() is also named score, producing a duplicate-column collision before projection. Affected tables cannot be BM25-searched at all from the CLI.

Error

Schema contains duplicate qualified field name "bm25_search()".score

Repro

# 1. Managed DB with a table that has a column literally named `score`
hotdata databases create --name "bm25 score repro" --catalog bm25repro --table widgets
hotdata databases set <db-id>
# widgets parquet has columns: id, name (text), score (double)
hotdata databases load --catalog bm25repro --table widgets --file widgets.parquet

# 2. BM25 index on the text column
hotdata indexes create --catalog bm25repro --table widgets --column name --type bm25

# 3. Search -> collision
hotdata search "alpha" --type bm25 --table bm25repro.public.widgets --column name
# error: Schema contains duplicate qualified field name "bm25_search()".score

Notes

  • --select id,name does not avoid it — the collision happens in the generated query's schema before the projection is applied.
  • Confirmed BM25 search works fine on a table without a score column (e.g. the listings demo table), where the relevance column is surfaced as score. That confirms the user's score column is the culprit.

Expected

A table that happens to have a score column should still be BM25-searchable. Options:

  • Alias the relevance column to a non-colliding / namespaced name (e.g. _bm25_score or bm25_score), or
  • Detect the collision and auto-suffix the generated relevance column.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions