File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/Share/Postgres/Search/DefinitionSearch Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -294,9 +294,10 @@ defNameCompletionSearch mayCaller mayFilter (Query query) limit = do
294
294
best_results(project_id, release_id, name, tag) AS (
295
295
SELECT m.project_id, m.release_id, m.name, m.tag
296
296
FROM matches_deduped_by_project m
297
- -- Prefer matches where the query is near the end of the name,
297
+ -- Prefer matches where the original query appears (case-matched),
298
+ -- then matches where the query is near the end of the name,
298
299
-- e.g. for query 'List', 'data.List' should come before 'data.List.map'
299
- ORDER BY length(m.name) - position(LOWER(#{query}) in LOWER(m.name)) ASC
300
+ ORDER BY m.name LIKE ('%' || #{query} || '%') DESC, length(m.name) - position(LOWER(#{query}) in LOWER(m.name)) ASC
300
301
LIMIT #{limit}
301
302
)
302
303
-- THEN sort docs to the bottom.
You can’t perform that action at this time.
0 commit comments