Fixed translation indexer for typesense

This commit is contained in:
Julio Ruiz 2026-01-30 17:07:30 -05:00
parent a3a16eb006
commit a937fc96f3
1 changed files with 13 additions and 13 deletions

View File

@ -18,7 +18,7 @@ let jsonlData = '';
const DATA_INPUT_FOLDER = './input'; const DATA_INPUT_FOLDER = './input';
const DATA_OUTPUT_FOLDER = './output'; const DATA_OUTPUT_FOLDER = './output';
const TEMPLATES_FOLDER = './templates'; const TEMPLATES_FOLDER = './templates';
const LOCALE = 'es'; const LOCALE = 'pt';
function generateMarkdown(type) { function generateMarkdown(type) {
const folderPath = `${DATA_INPUT_FOLDER}/${type}`; const folderPath = `${DATA_INPUT_FOLDER}/${type}`;
@ -213,12 +213,12 @@ async function generateJson( type ) {
nitem.duration = item.activities_id?.duration ?? 0; nitem.duration = item.activities_id?.duration ?? 0;
nitem.year = dayjs(item.activities_id?.date).year().toString() nitem.year = dayjs(item.activities_id?.date).year().toString()
nitem.month = item.year + " > " + (dayjs(item.activities_id?.date).month()+1).toString().padStart(2,"0") nitem.month = nitem.year + " > " + (dayjs(item.activities_id?.date).month()+1).toString().padStart(2,"0")
nitem.menu_lvl0 = item.country nitem.menu_lvl0 = nitem.country
nitem.menu_lvl1 = item.country + " > " + item.state nitem.menu_lvl1 = nitem.country + " > " + nitem.state
nitem.menu_lvl2 = item.country + " > " + item.state + " > " + item.city nitem.menu_lvl2 = nitem.country + " > " + nitem.state + " > " + nitem.city
nitem.menu_lvl3 = item.country + " > " + item.state + " > " + item.city + " > " + item.place nitem.menu_lvl3 = nitem.country + " > " + nitem.state + " > " + nitem.city + " > " + nitem.place
nitem.date = dayjs(item.activities_id?.date).unix() nitem.date = dayjs(item.activities_id?.date).unix()
@ -226,7 +226,7 @@ async function generateJson( type ) {
} }
if( type == 'conferences_translations' ){ if( type == 'conferences_translations' ){
nitem.id = item.conferences_id?.id nitem.id = item.conferences_id?.id.toString()
nitem.title = item.title nitem.title = item.title
nitem.body = he.decode(striptags(item.text_published)) || '' nitem.body = he.decode(striptags(item.text_published)) || ''
nitem.private = item.conferences_id?.public == 0 ? true : false; nitem.private = item.conferences_id?.public == 0 ? true : false;
@ -245,12 +245,12 @@ async function generateJson( type ) {
nitem.duration = item.conferences_id?.duration ?? 0; nitem.duration = item.conferences_id?.duration ?? 0;
nitem.year = dayjs(item.conferences_id?.date).year().toString() nitem.year = dayjs(item.conferences_id?.date).year().toString()
nitem.month = item.year + " > " + (dayjs(item.conferences_id?.date).month()+1).toString().padStart(2,"0") nitem.month = nitem.year + " > " + (dayjs(item.conferences_id?.date).month()+1).toString().padStart(2,"0")
nitem.menu_lvl0 = item.country nitem.menu_lvl0 = nitem.country
nitem.menu_lvl1 = item.country + " > " + item.state nitem.menu_lvl1 = nitem.country + " > " + nitem.state
nitem.menu_lvl2 = item.country + " > " + item.state + " > " + item.city nitem.menu_lvl2 = nitem.country + " > " + nitem.state + " > " + nitem.city
nitem.menu_lvl3 = item.country + " > " + item.state + " > " + item.city + " > " + item.place nitem.menu_lvl3 = nitem.country + " > " + nitem.state + " > " + nitem.city + " > " + nitem.place
nitem.date = dayjs(item.conferences_id?.date).unix() nitem.date = dayjs(item.conferences_id?.date).unix()
@ -334,5 +334,5 @@ function writeFile( jsonlData, type ){
// } // }
//for( let year = 2021; year < 2027; year++){ //for( let year = 2021; year < 2027; year++){
generateJson( 'conferences_translations' ); generateJson( 'activities_translations' );
//} //}