Skip to content

ORDER BY $score DESC hangs when combined with non-FTS WHERE predicates #3776

Closed

Description

@invidious9000

Environment

  • ArcadeDB v26.4.1-SNAPSHOT (build 6964490/1775244244683/main)
  • 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.

Additionally, $score always returns 1.0 on polymorphic supertype indexes (per-type indexes return correct matched-term counts).

Reproduction

Works: SEARCH_INDEX as sole predicate

SELECT id, name, $score AS score FROM Decision
WHERE SEARCH_INDEX('Decision[name,rationale]', 'dispatch pipeline hivemind') = true
ORDER BY $score DESC LIMIT 3
-- 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 = 1
ORDER BY $score DESC LIMIT 3
-- 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
LIMIT 5
-- 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.

Activity

  1. 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
  2. self-assigned this
    on Apr 4, 2026
  3. added theissue type on Apr 4, 2026
  4. added this to the 26.4.1 milestone on Apr 4, 2026
  5. 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
  6. lvca commented on Apr 4, 2026

    @lvca
    Member

    Should be fixed now. I tried to create a test case based on your input to avoid regressions. Please let me know if works.

  7. invidious9000 commented on Apr 4, 2026

    @invidious9000
    Author

    Should be fixed now. I tried to create a test case based on your input to avoid regressions. Please let me know if works.

    Fix works, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions