Fix: Restore specialized search logic for Event Sessions and Presenters
This commit is contained in:
@@ -361,33 +361,37 @@ export async function update_ae_obj__event_session({
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
// Updated 2026-01-21 to Restore Full Aether Search Logic
|
||||
export async function search__event_session({
|
||||
api_cfg,
|
||||
event_id,
|
||||
qry_str = '',
|
||||
poc_agree = null,
|
||||
file_count = false,
|
||||
fulltext_search_qry_str = '',
|
||||
ft_presenter_search_qry_str = '',
|
||||
like_search_qry_str = '',
|
||||
like_presentation_search_qry_str = '',
|
||||
like_presenter_search_qry_str = '',
|
||||
like_poc_name_qry_str = '',
|
||||
location_name = null,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 25,
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
order_by_li = [
|
||||
{ priority: 'DESC' },
|
||||
{ sort: 'DESC' },
|
||||
{ sort: 'ASC' },
|
||||
{ start_datetime: 'ASC' },
|
||||
{ name: 'ASC' },
|
||||
{ updated_on: 'DESC' }
|
||||
{ name: 'ASC' }
|
||||
],
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
qry_str?: string;
|
||||
poc_agree?: null | boolean;
|
||||
file_count?: boolean;
|
||||
fulltext_search_qry_str?: string;
|
||||
ft_presenter_search_qry_str?: string | null;
|
||||
like_search_qry_str?: string;
|
||||
like_presentation_search_qry_str?: string;
|
||||
like_presenter_search_qry_str?: string;
|
||||
like_poc_name_qry_str?: string;
|
||||
location_name?: null | string;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled';
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden';
|
||||
@@ -398,37 +402,54 @@ export async function search__event_session({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventSession[]> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** search__event_session() *** [V3] event_id=${event_id} qry=${qry_str}`);
|
||||
console.log(`*** search__event_session() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`);
|
||||
}
|
||||
|
||||
// 1. Build the search query body
|
||||
const search_query: any = {
|
||||
q: qry_str,
|
||||
q: '', // Default query string
|
||||
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
|
||||
};
|
||||
|
||||
if (poc_agree !== null) {
|
||||
search_query.and.push({ field: 'poc_agree', op: 'eq', value: poc_agree });
|
||||
// 2. Build the params object for special flags (the 'params_json' equivalent)
|
||||
const params: key_val = {};
|
||||
|
||||
// 3. Restore the Fulltext Logic
|
||||
if (fulltext_search_qry_str || ft_presenter_search_qry_str) {
|
||||
params['ft_qry'] = {};
|
||||
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
params['ft_qry']['default_qry_str'] = fulltext_search_qry_str;
|
||||
}
|
||||
if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) {
|
||||
params['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_count) {
|
||||
search_query.and.push({ field: 'file_count', op: 'gt', value: 0 });
|
||||
// 4. Restore the 'Like' Logic
|
||||
if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str || like_poc_name_qry_str) {
|
||||
params['lk_qry'] = {};
|
||||
if (like_search_qry_str) params['lk_qry']['default_qry_str'] = like_search_qry_str;
|
||||
if (like_presentation_search_qry_str) params['lk_qry']['event_presentation_li_qry_str'] = like_presentation_search_qry_str;
|
||||
if (like_presenter_search_qry_str) params['lk_qry']['event_presenter_li_qry_str'] = like_presenter_search_qry_str;
|
||||
if (like_poc_name_qry_str) params['lk_qry']['poc_person_full_name'] = like_poc_name_qry_str;
|
||||
}
|
||||
|
||||
if (location_name) {
|
||||
search_query.and.push({ field: 'event_location_name', op: 'like', value: `%${location_name}%` });
|
||||
}
|
||||
|
||||
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
|
||||
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: false });
|
||||
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
|
||||
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
|
||||
|
||||
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: true });
|
||||
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: false });
|
||||
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
|
||||
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
|
||||
|
||||
const result_li = await api.search_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'event_session',
|
||||
search_query,
|
||||
order_by_li,
|
||||
params, // Pass the special flags into the V3 params
|
||||
limit,
|
||||
offset,
|
||||
log_lvl
|
||||
|
||||
Reference in New Issue
Block a user