The AND LIKE query is now working!

This commit is contained in:
2024-04-07 17:26:48 -04:00
parent bde3229270
commit 1ae1a3d989
3 changed files with 44 additions and 18 deletions

View File

@@ -171,7 +171,16 @@ async function handle_load_ae_obj_li__badge(
async function handle_search__event_badge(
{api_cfg, event_id, type_code=null, fulltext_search_qry_str, like_search_qry_str=null, external_event_id, params={}, try_cache=true
}
}: {
api_cfg: any,
event_id: any,
type_code: any,
fulltext_search_qry_str: any,
like_search_qry_str: any,
external_event_id: any,
params: any,
try_cache: boolean
}
) {
console.log(`*** handle_search__event_badge() *** event_id=${event_id}`);
@@ -200,12 +209,12 @@ async function handle_search__event_badge(
// log.debug(query_str_like)
// data['query_str'] = f'%{query_str_like}%'
let like_search_qry_str_new = like_search_qry_str.trim().replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%');
like_search_qry_str_new = `%${like_search_qry_str_new}%`;
console.log('like_search_qry_str_new:', like_search_qry_str_new);
// let like_search_qry_str_new = like_search_qry_str.trim().replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%');
// like_search_qry_str_new = `%${like_search_qry_str_new}%`;
// console.log('like_search_qry_str_new:', like_search_qry_str_new);
params_json['like_qry'] = {
'default_qry_str': like_search_qry_str_new,
params_json['and_like'] = {
'default_qry_str': like_search_qry_str,
};
}

View File

@@ -842,6 +842,7 @@ export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
console.log('JSON Object:', params_json);
console.log(JSON.stringify(params_json));
// NOTE: "jp" stands for "JSON Params"
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
if (params['jp'].length > 2083) {