You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
format!("SELECT {} FROM iqps WHERE approve_status = false and is_deleted=false ORDER BY upload_timestamp ASC",ADMIN_DASHBOARD_QP_FIELDS)
81
81
}
82
82
83
-
/// Searches for papers using the given query_text (parameter `$1`). This is total voodoo by Rajiv Harlalka. The second parameter can be used to filter by exam.
84
-
/// // TODO: @Rajiv please update this documentation to explain the voodoo.
85
-
constQP_SEARCH:&str = "
86
-
with fuzzy as (
87
-
select id,
88
-
similarity(course_code || ' ' || course_name, $1) as sim_score,
89
-
row_number() over (order by similarity(course_code || ' ' || course_name, $1) desc) as rank_ix
90
-
from iqps
91
-
where (course_code || ' ' || course_name) %>> $1 AND approve_status = true
92
-
order by rank_ix
93
-
limit 30
94
-
),
95
-
full_text as (
96
-
select
97
-
id,
98
-
ts_rank_cd(fts_course_details, websearch_to_tsquery($1)) as rank_score,
99
-
row_number() over(order by ts_rank_cd(fts_course_details , websearch_to_tsquery($1)) desc) as rank_ix
100
-
from
101
-
iqps
102
-
where
103
-
fts_course_details @@ websearch_to_tsquery($1)
104
-
AND approve_status = true
105
-
order by rank_ix
106
-
limit 30
107
-
),
108
-
partial_search as (
109
-
select id,
110
-
ts_rank_cd(fts_course_details , to_tsquery('simple', websearch_to_tsquery('simple', $1)::text || ':*' )) as rank_score,
111
-
row_number() over(order by ts_rank_cd(fts_course_details , to_tsquery('simple', websearch_to_tsquery('simple', $1)::text || ':*' )) desc) as rank_ix
0 commit comments