You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ORDER BY $score DESC hangs when combined with non-FTS WHERE predicates #3776
Running on Linux 6.12.77-1-MANJARO, OpenJDK 21.0.10 (Temurin-21.0.10+7)
Full-text indexes created with CREATE INDEX ON Type (field) FULL_TEXT
Summary
ORDER BY $score DESC hangs indefinitely when combined with a non-FTS predicate (e.g. AND project_id = :pid) in the WHERE clause. This applies to both per-type and polymorphic supertype indexes.
SELECT id, name, $score AS score FROM Decision
WHERE SEARCH_INDEX('Decision[name,rationale]', 'dispatch pipeline hivemind') = true
ORDER BY $score DESCLIMIT3-- Returns immediately with correct scores (3.0, 1.0, 1.0)
Hangs: SEARCH_INDEX + additional WHERE predicate
SELECT id, name, $score AS score FROM Decision
WHERE SEARCH_INDEX('Decision[name,rationale]', 'dispatch pipeline hivemind') = true
AND project_id =1ORDER BY $score DESCLIMIT3-- Hangs indefinitely (tested 100+ seconds)
Removing ORDER BY $score DESC from the second query makes it return immediately.
Polymorphic $score always 1.0
SELECT @type, searchable_text, $score AS score FROM Searchable
WHERE SEARCH_INDEX('Searchable[searchable_text]', 'dispatch pipeline hivemind') = true
LIMIT5-- All results: score = 1.0 (per-type queries return correct variable scores)
Expected
ORDER BY $score DESC should work regardless of additional WHERE predicates.
Workaround
We omit ORDER BY $score DESC from all queries that include non-FTS WHERE predicates and rely on Lucene's native result ordering.
changed the title [-]$score returns 1.0 for all full-text search results and ORDER BY $score hangs[/-][+]$score returns 1.0 and ORDER BY $score hangs on polymorphic supertype full-text indexes[/+]on Apr 4, 2026
changed the title [-]$score returns 1.0 and ORDER BY $score hangs on polymorphic supertype full-text indexes[/-][+]ORDER BY $score DESC hangs when combined with non-FTS WHERE predicates[/+]on Apr 4, 2026
Activity
[-]$score returns 1.0 for all full-text search results and ORDER BY $score hangs[/-][+]$score returns 1.0 and ORDER BY $score hangs on polymorphic supertype full-text indexes[/+][-]$score returns 1.0 and ORDER BY $score hangs on polymorphic supertype full-text indexes[/-][+]ORDER BY $score DESC hangs when combined with non-FTS WHERE predicates[/+]fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
lvca commentedon Apr 4, 2026
Should be fixed now. I tried to create a test case based on your input to avoid regressions. Please let me know if works.
invidious9000 commentedon Apr 4, 2026
Fix works, thank you!
chore(deps): bump the github-actions group with 3 updates [skip ci]
fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
chore(deps): bump the github-actions group with 3 updates [skip ci]
fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
fix: $score returns 1.0 and ORDER BY $score hangs on polymorphic supe…
chore(deps): bump the go-modules group across 1 directory with 3 upda…