-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect search ranking #250
Labels
bug
Something isn't working
Comments
WITH search_terms AS (
SELECT unnest(regexp_split_to_array('vsphere', '[ /]+')) AS term
),
term_matches AS (
SELECT e.*
FROM entities e
INNER JOIN search_terms st
ON e.addr ILIKE '%' || st.term || '%'
OR e.description ILIKE '%' || st.term || '%'
GROUP BY e.id
),
ranked_entities AS (
SELECT *,
CASE WHEN link_variables->>'namespace' = 'hashicorp' THEN 1 WHEN link_variables->>'namespace' = 'opentofu' THEN 0 ELSE 0.5 END as popularity_fudge,
similarity(tm.addr, 'vsphere') as title_sim,
similarity(tm.description, 'vsphere') as description_sim,
similarity(link_variables->>'name', 'vsphere') as name_sim
FROM term_matches tm
),
providers AS (
SELECT *
FROM ranked_entities
WHERE type LIKE 'provider%'
ORDER BY
popularity_fudge DESC,
title_sim DESC,
name_sim DESC,
description_sim DESC
LIMIT 10
),
modules AS (
SELECT *
FROM ranked_entities
WHERE type LIKE 'module%'
ORDER BY
popularity_fudge DESC,
title_sim DESC,
name_sim DESC,
description_sim DESC
LIMIT 10
)
select * from providers
UNION ALL
select * from modules; |
Thanks @cam72cam with some tweaks this partially fixed it, still need to add the popularity ranking later. |
4 tasks
@cam72cam I think we can close this issue since the popularity ranking is implemented here https://github.com/opentofu/registry-ui/blob/main/search/worker/src/query.ts#L22 Feel free to reopen if there's something I've missed. |
Fixed with 50e7c1b and deployed. Closing the ticket. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current search ranking is less than optimal and should be improved.
The text was updated successfully, but these errors were encountered: