Skip to content

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

@invidious9000

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions