Fix: Restore specialized search logic for Event Sessions and Presenters

This commit is contained in:
Scott Idem
2026-01-21 14:05:17 -05:00
parent d705058175
commit 95f2ab79be
3 changed files with 156 additions and 34 deletions

View File

@@ -331,6 +331,91 @@ export async function update_ae_obj__event_presentation({
return result;
}
// Updated 2026-01-21 to Restore Full Aether Search Logic
export async function search__event_presentation({
api_cfg,
event_id,
fulltext_search_qry_str = '',
like_search_qry_str = '',
enabled = 'enabled',
hidden = 'not_hidden',
limit = 50,
offset = 0,
order_by_li = [
{ sort: 'ASC' },
{ start_datetime: 'ASC' },
{ name: 'ASC' }
],
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
fulltext_search_qry_str?: string;
like_search_qry_str?: string;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
limit?: number;
offset?: number;
order_by_li?: any;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresentation[]> {
if (log_lvl) {
console.log(`*** search__event_presentation() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`);
}
const search_query: any = {
q: '',
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
};
const params: key_val = {};
// Restore Fulltext logic
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
params['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str };
}
// Restore Like logic
if (like_search_qry_str) {
params['lk_qry'] = { 'default_qry_str': like_search_qry_str };
}
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: 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_presentation',
search_query,
order_by_li,
params,
limit,
offset,
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
}
return result_li || [];
}
export const properties_to_save = [
'id',
'event_presentation_id',
@@ -365,6 +450,7 @@ export const properties_to_save = [
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,

View File

@@ -301,11 +301,12 @@ export async function update_ae_obj__event_presenter({
return result;
}
// Updated 2026-01-20 to V3
// Updated 2026-01-21 to Restore Full Aether Search Logic
export async function search__event_presenter({
api_cfg,
event_id,
qry_str = '',
fulltext_search_qry_str = '',
like_search_qry_str = '',
agree = null,
biography = null,
enabled = 'enabled',
@@ -313,8 +314,7 @@ export async function search__event_presenter({
limit = 25,
offset = 0,
order_by_li = [
{ priority: 'DESC' },
{ sort: 'DESC' },
{ sort: 'ASC' },
{ given_name: 'ASC' },
{ family_name: 'ASC' }
],
@@ -323,7 +323,8 @@ export async function search__event_presenter({
}: {
api_cfg: any;
event_id: string;
qry_str?: string;
fulltext_search_qry_str?: string;
like_search_qry_str?: string;
agree?: null | boolean;
biography?: null | boolean;
enabled?: 'enabled' | 'all' | 'not_enabled';
@@ -335,28 +336,41 @@ export async function search__event_presenter({
log_lvl?: number;
}): Promise<ae_EventPresenter[]> {
if (log_lvl) {
console.log(`*** search__event_presenter() *** [V3] event_id=${event_id} qry=${qry_str}`);
console.log(`*** search__event_presenter() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`);
}
const search_query: any = {
q: qry_str,
q: '',
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
};
if (agree !== null) search_query.and.push({ field: 'agree', op: 'eq', value: agree });
const params: key_val = {};
// Restore Fulltext logic
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
params['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str };
}
// Restore Like logic
if (like_search_qry_str) {
params['lk_qry'] = { 'default_qry_str': like_search_qry_str };
}
if (agree !== null) search_query.and.push({ field: 'agree', op: 'eq', value: agree ? 1 : 0 });
if (biography === true) search_query.and.push({ field: 'biography', op: 'ne', value: '' });
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_presenter',
search_query,
order_by_li,
params,
limit,
offset,
log_lvl
@@ -487,6 +501,7 @@ export const properties_to_save = [
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,

View File

@@ -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