Repository navigation
An entity is fetched by its exact name with exact=true, so a lookup uses the name index instead of scanning the base - #1491
Merged
Conversation
…ses the name index instead of scanning the base Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
…longer scans the base's entities Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
WaylandYang
approved these changes
Nov 10, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks, the exact path keeps the default unchanged and uses the index. Merging.
gedaiu
added a commit
to re-cinq/utopia
that referenced
this pull request
Nov 10, 2026
Sync upstream dev into re-dev (2026-11-10): deeplethe#1487, deeplethe#1488, deeplethe#1490, deeplethe#1491
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1479
Entity search takes an optional
exact=true. With it, the search matches only entities whose canonical name or a current alias equals the text (folded to lower case), so the lookup goes through the existing name indexes (entities_kb_name_idxfor the canonical name,facts_value_text_idxfor aliases) instead of scanning the whole base withILIKE '%text%'. The two are read as one set of ids, because anORwith a subquery on one side leaves the planner a scan of the base's entities. In a replay (as_of) the canonical-name index cannot serve, since it only holds entities that are not merged today, so that half filters the base's entities instead. The total is counted the same way. Without the parameter nothing changes: it is the same substring search, the exact name still sorts first, and the MCP lookup tool passesfalse. On our base a lookup by file path took 11.5 to 17.6 s, against 0.8 s for theentity_detailthat follows it. On a seeded base of 300k entities the default search takes about 1.4 s andexact=trueabout 70 ms.There is a store test for
a.tsagainsta.ts#parse(exact, default and mixed case) a replay case for an entity that was merged later, and a route test with a read token, which can already reach this route, so no auth or ADR change is needed.This follows the proposal in the issue, and we are glad to reshape it however you prefer.