Firefox PHP

Chinese Search module (enable searching for Chinese text)

Posted by sheik 
Chinese Search module (enable searching for Chinese text)
November 30, 2006 12:21PM
(Related thread: [www.phorum.org])

Problem: full text searching in Phorum 5.1.x or later does not work for languages which do not use spaces between words. For example, Chinese.

It is possible to revert to the old method of searching by changing include/db/config.php (set use_ft = 0)

However, this loses all the benefits of the new Full Text searching for Western languages.

Solution: This module detects a Chinese search term and temporarily disables the full text searching. ie: Chinese searches will work in the same way as they did in older versions of Phorum.

Download the module here: [www.celerity.co.uk]

Hopefully this will help a few sites!

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Chinese Search module (enable searching for Chinese text)
February 20, 2007 11:07AM
Thanks sheik for the mod.
I think this is mod very useful.
But when I used this mod,the page show me:

Fatal error: Call to undefined function: mb_substr() in
\www\phorum5\mods\chinesesearch\chinesesearch.php on line 28


How can I defined this function?



Edited 2 time(s). Last edit at 02/20/2007 11:40AM by tornado7.
Re: Chinese Search module (enable searching for Chinese text)
February 20, 2007 04:34PM
you need to compile in the mb_extension in php.


Thomas Seifert
Re: Chinese Search module (enable searching for Chinese text)
February 20, 2007 08:00PM
Thanks for ts77's answer
But I test my webpage in windows,and I don't have any compile tools for windows.
Then I update my php -> 5.1.6
But have new question:

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\include\format_functions.php on line 49

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\mods\bbcode\bbcode.php on line 73

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\mods\smileys\smileys.php on line 36

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\include\format_functions.php on line 109

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phorum5\include\format_functions.php:49) in C:\WINDOWS\Temp\tpl-default-header-toplevel_stage2-91e7b1a6607768216ce66dfa287837fd.php on line 5


I should return to php-4.x.x?
Thanks so much again.



Edited 1 time(s). Last edit at 02/20/2007 08:27PM by tornado7.
Re: Chinese Search module (enable searching for Chinese text)
February 20, 2007 11:48PM
I am running Phorum on PHP 5.2.1 myself. Phorum runs perfectly on that version. So this is something else that is going wrong and not a PHP versioning problem. Allthough, if you can fix things by going back to 4.x.x, then try that. In that case it could be something in the php.ini that is different, allthough I can't think of anything applicable here.

If you disable all modules, do you still get the messages or are they gone then? If this is module related, then try to pin point the module by enabling them one by one, until the error messages appear again.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Chinese Search module (enable searching for Chinese text)
February 22, 2007 10:55AM
Thanks for mmakaay's reply.
I test my webpage on PHP 5.2.1 and got warning message again.

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\mods\html\html.php on line 10

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\mods\smileys\smileys.php on line 36

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\phorum5\include\format_functions.php on line 109

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phorum5\include\format_functions.php:49) in C:\WINDOWS\Temp\tpl-martha_with_settings-header-toplevel_stage2-91e7b1a6607768216ce66dfa287837fd.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phorum5\include\format_functions.php:49) in C:\WINDOWS\Temp\tpl-martha_with_settings-header-toplevel_stage2-91e7b1a6607768216ce66dfa287837fd.php on line 6


And then,I test on PHP 4.x.x again, still got error message.

Fatal error: Call to undefined function: mb_substr() in
\www\phorum5\mods\chinesesearch\chinesesearch.php on line 28


I guess it has complete extension when I used PHP5 module,so there is not undefined function message.
I test the phorum5 module one by one,and those warning message are made by Chinese Search module.
But I need this module,because full text searching in Phorum 5.1.x can't work for Chinese searching.
mmakaay's reply to me : "Phorum runs perfectly on that version."
That is mean only Phorum5 runs without any module?
How can I disable the full text searching temporarily when I used Chinese search?
I must rewrite the php.ini?
Thank you very much.



Edited 3 time(s). Last edit at 02/22/2007 11:02AM by tornado7.
Re: Chinese Search module (enable searching for Chinese text)
February 22, 2007 12:05PM
there is a simple setting in include/db/config.php to disable fulltext searching. no need for the mod.
no, his reply doesn't mean it only works without any module but maybe this module has a bug or something which we aren't responsible for.
the simple answer is: if phorum only works without a given module then this module is broken.


Thomas Seifert
Re: Chinese Search module (enable searching for Chinese text)
March 21, 2007 07:36AM
A new version has been released, you can download it from the same link above.
I hate to say it but the previous version was not working correctly at all, as it was using the wrong hook. I originally tested the module using the "common" hook I believe, and then changed it to use the "search" hook. However, I didn't realise that changes to info.txt require a module disable/reenable in the admin, so never actually realised that the "search" hook occurs too late for this module to work - bah!

It is now using the "search_action" hook which I found whilst rummaging through search.php. I hope this hook will be continued to be supported in future versions...

Anyway, apologies to anyone who downloaded the old version and couldn't see any difference to their Chinese searches :-(

/\dam

P.S. None of this helps tornado7's problem above, which occurs because his server is not set up for PHPs multibyte string extension (mb_string) I think.

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Sorry, only registered users may post in this forum.

Click here to login