call function

More
9 years 2 months ago #3224 by leyla20
call function was created by leyla20
Good evening,

I have a website about turkey and i am busy with rewriting all the hotel names by using a call back. It was working fine but at this moment it looks like it is not working fine anymore. At this moment i have more then 1200 rules in my callback list.
My server got enough memory and cpu so this cant be the issue.
Is there something else i got to change? Or do i need to empty the database manualy first and then do a cronjob again?

I hope someone got a good answer

Kind regards,


michel

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #3225 by bram
Replied by bram on topic call function
any types of error messages somewhere?

How are you rewritting the names?

Using a lookup table is the most efficient. I have tables with thousends of names without problems.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago - 9 years 2 months ago #3226 by leyla20
Replied by leyla20 on topic call function
Hi Bram,

I do not get any errors. But i saw that some names just dont get rewrited. I guess that a special mark (for example a dot or komma) in the name can cause some issues. But the most of them do not have a special mark in it.

Here a small example of the way i rewrite the names. Do you also mean this with a lookup table?

<?
global $naam2naam;
$naam2naam=array();
'Balim Hotel'=>'Balim',
'Hotel Balim'=>'Balim',
'Appartement Green Park'=>'Aparthotel Green Park',
'Green Park'=>'Aparthotel Green Park',
'App. Green Park'=>'Aparthotel Green Park',
'Green Park Apart Hotel'=>'Aparthotel Green Park',
'Appartementen Green Park'=>'Aparthotel Green Park',
'Antique Roman Palace'=>'Antik Roman Palace Hotel',
'Antique Roman Palace Hotel'=>'Antik Roman Palace Hotel',
'Hotel Antique Roman Palace'=>'Antik Roman Palace Hotel',
);



function naam2naam($iso) {
global $encoding;
global $naam2naam;
$m=$naam2naam[$iso];
if ( $encoding=='UTF-8' ) {
$m=utf8_encode($m);
}
return $m?$m:$iso;
}
Last edit: 9 years 2 months ago by leyla20. Reason: extra info

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago - 9 years 2 months ago #3227 by bram
Replied by bram on topic call function
First I assume that the extra ) in $naam2naam=array(); is a typo

ensure the file is utf 8 encoded. then you can skip the encoding in the function. Current versions of the parser work in UTF-8 by default

Capitals might be an issue Balim Hotel or Balim hotel,

you can solve this by using all lowercase in the left column, adding a strtolower to the function.

another issue might be that the parser strips certain characters. Not the dot but '`ยด/-:&\"?_+#%><;' will.

The characters are stripped at the very end of the import, after the callback function. So the names as they appear in the callback function might be different from the ones in the database
Code:
function naam2naam($iso) { global $naam2naam; $m=$naam2naam[prepare_for_sql_url(strtolower($iso))]; return $m?$m:$iso; }
Last edit: 9 years 2 months ago by bram.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #3228 by leyla20
Replied by leyla20 on topic call function
Yes indeed the extra ) was a typo.
I put an extra function inside for the lowercase and will take a look if everything is uft 8 because i am not 100% sure about that.

Thanks for the help. I will let you know the end results.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #3232 by leyla20
Replied by leyla20 on topic call function
Hi Bram,

As promised i would let you know if it helped.
I changed all to utf-8 and made everything in lowercase. Till now it looks like that the renaming is working better.

Thanks for your tip.

Kind regards,

Michel

Please Log in or Create an account to join the conversation.

Time to create page: 0.219 seconds