Firefox PHP

Rebuild Search Data is not working

Posted by Eckhard 
Rebuild Search Data is not working
July 26, 2018 11:40PM
Hi all,

while taking over Phorum data from mysnip I set up a new Phorum (version 5.3-dev from Github). I was able to import the data successfully. Using PHP 7.2 I got a few warnings so I moved to PHP 5.6. The warnings are gone.

Unfortunately the search is not working. The phorum_search table contains only 0 or 1 in the column search_text. Rebuilding search data in Phorum Admin didn't solve the problem. Does anybody has an idea how to solve that?

Thx in advance!

Best, Eckhard



Edited 2 time(s). Last edit at 07/27/2018 12:15PM by Eckhard.
Re: Search is not working
July 27, 2018 03:23AM
Later versions of mysql use "innodb" as the default data engine, the Phorum search table requires "myisam". You may have everything but the search table using innodb.

You may need to enable the myisam engine.
You only need to create the structure for the search table using myisam, phorum can fill it.
Re: Search is not working
July 27, 2018 09:19AM
Hi Scott,

every table uses MyISAM already. After a few investigation I found out that the search table creation is working fine after editing or creating a message. The "Rebuild search data" action is not working, it will destroy all the entries in the phorum_search table.

How to reproduce:

Set up an new phorum straight forward. Open the Phorum and search for "test". You will get the sample message. If you like look into the database table phorum_search, you will see the content of the sample message in column "search_test". Now open then Admin page and run "Rebuild search data" from "Database Integrity". After that searching will fail and the search_text column will have only 0 and 1. If you add a new message to the forum you will find that anyhow.

Means: The normal search indexing is working fine but the Rebuild search data fails. Due to the fact that I have to import about 16000 messages into the forum I need the rebuild feature.

Hope somebody can fix that.

Best, Eckhard
Re: Search is not working
July 27, 2018 05:20PM
There is a rebuild search data script, " rebuild_search_table.php " in the scripts directory.
Run it, on the server.

Info from the mysql error log and php error log would be helpful.
Re: Search is not working
July 27, 2018 05:36PM
Sorry, this is in a webspace, I am unable to run php directly and I have no access to the mysql and php logs. I will try to repeat that on my own server.
Re: Search is not working
July 27, 2018 05:58PM
okay, no hints in the error logs. rebuild_search_table.php is not working too:

malc@malc /var/www/html/phorum/scripts> ./rebuild_search_table.php

Rebuilding search-table ...
If no errors were logged above,
then the search table was successfully rebuilt.


Server 1:
Database server
Server: Localhost via UNIX socket
Server type: MariaDB
Server version: 10.1.26-MariaDB-0+deb9u1 - Debian 9.1
Protocol version: 10
User: malc@localhost
Server charset: UTF-8 Unicode (utf8)

PHP 7.0.30-0+deb9u1 (cli) (built: Jun 14 2018 13:50:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.30-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies


server 2
Server: dd43722 via TCP/IP
Server type: MySQL
Server version: 5.7.21-nmm1-log - (Ubuntu)
Protocol version: 10
User: d02b3d9b@ xxxxxxx
Server charset: UTF-8 Unicode (utf8)

PHP 5.6



Edited 2 time(s). Last edit at 07/27/2018 06:05PM by Eckhard.
Re: Rebuild Search Data is not working
July 27, 2018 07:38PM
Note that I am at a loss as to what is going on.

Try...
Change to an earlier version of Phorum, and install it using php 5.6. (php 7+ has issues in the admin, so I don't trust it.)

[web.archive.org] select the Download Phorum 5.2.20 button.



Edited 1 time(s). Last edit at 07/27/2018 07:39PM by Scott Finegan.
Re: Rebuild Search Data is not working
July 29, 2018 10:32AM
ok, I went back to 5.2.23. With that the Rebuild search data is working. But I have to live without a few features from 5.3. And with PHP 7.2 Phorum 5.2.23 creates errors and warnings!

Thanks for your help!



Edited 1 time(s). Last edit at 07/29/2018 10:35AM by Eckhard.
Re: Rebuild Search Data is not working
July 29, 2018 04:25PM
Thanks for the update, it helps a bit isolating the cause.
I would not count on Phorum ever working with php 7.x
Re: Rebuild Search Data is not working
August 02, 2018 07:46AM
can you list the errors and warnings you got?


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Rebuild Search Data is not working
August 02, 2018 09:08AM
In general Phorum 5.2.23 runs okay with PHP 7.2. But the Admin console raises warnings and errors like:

Warning: count(): Parameter must be an array or an object that implements Countable in /www/htdocs/w01537c5/archiv/include/admin/PhorumInputForm.php on line 213


Parse error: syntax error, unexpected 'new' (T_NEW) in /www/htdocs/w01537c5/archiv/mods/german_language_support/settings.php on line 48
The lanquage module config is not working.

Maybe there is more that I didn't find.



Edited 2 time(s). Last edit at 08/02/2018 09:58AM by Eckhard.
Re: Rebuild Search Data is not working
August 02, 2018 11:08PM
This error occurs when attempting to rebuild the search table, after a new install.

phorum 5.3 dev with   php 7.2.7   on   IIS7  and  mysql 5.7

Phorum Database Error
Sorry, a Phorum database error occurred.
Please try again later!
Error:
Truncated incorrect DOUBLE value: 'Phorum Installer' (1292): INSERT INTO phorumCore_search (message_id, search_text, forum_id) SELECT message_id, author || ' | ' || subject || ' | ' || body, forum_id FROM phorumCore_messages
Backtrace:
Function interact() called at
{path to Phorum}\include\db\PhorumMysqlDB.php:164
----
Function interact() called at
{path to Phorum}\include\db\PhorumDB.php:7335
----
Function rebuild_search_data() called at
{path to Phorum}\include\admin\rebuild.php:121
----
Function require_once() called at
{path to Phorum}\admin.php:133
Re: Rebuild Search Data is not working
August 03, 2018 08:14PM
Other issues...


Phorum 5.2.23 new install,  php 7.2.7   on   IIS7  and  mysql 5.7

-----------------------------------
From the event log

Message:

PHP warning: count(): Parameter must be an array or an object that implements Countable

PHP warning generated at C:\HoldD\xxxxx\Phorum5223\include\admin\PhorumInputForm.php:213

Back trace:

Function show called at
{path to Phorum}\include\admin\mods.php:146
----
Function include_once called at
{path to Phorum}\admin.php:109



---------------------------------------------------------------------

from php 7.2x errors_log

[03-Aug-2018 10:55:53 America/Tegucigalpa] PHP Deprecated:  Directive 'track_errors' is deprecated in Unknown on line 0


[php.net]



track_errors ini setting and $php_errormsg variable

When the track_errors ini setting is enabled, a $php_errormsg variable is created in the local scope when a non-fatal error occurs. Given that the preferred way of retrieving such error information is by using error_get_last(), this feature has been deprecated.
Re: Rebuild Search Data is not working
January 11, 2019 01:03AM
Has anyone figured out a fix (or can point me in the right direction) for the following issue when updating to PHP 7.x ::
___________________________________________________________________________________________

Warning: count(): Parameter must be an array or an object that implements Countable in ..../.../.../include/admin/PhorumInputForm.php on line 21x

Here's the affected section of code:

function show()
{
$PHORUM = $GLOBALS['PHORUM'];

if(count($this->_help)){
echo "<script type=\"text/javascript\">\nvar help = Array;\n";
foreach($this->_help as $key=>$data){
echo "help[$key] = [\"$data[0]\", \"$data[1]\"];\n";
}
echo "</script>\n";
}
echo "<form style=\"display: inline;\" " .
"action=\"".htmlspecialchars($this->_action)."\" " .
"method=\"$this->_method\"";
if ( !empty( $this->_target ) ) echo " target=\"$this->_target\"";
if ( !empty( $this->_enctype ) ) echo " enctype=\"$this->_enctype\"";
foreach ($this->_events as $event => $code) {
echo " $event=\"".htmlspecialchars($code)."\"";
}
echo ">\n";
Re: Rebuild Search Data is not working
January 11, 2019 02:22PM
I may have a fix for the above - it appears to be working ok for my site anyway.

Edit the following file:

.../include/admin/PhorumInputForm.php

Locate the code at around line 211 and modify as suggested

function show()
{
$PHORUM = $GLOBALS['PHORUM'];
//Fix for PHP Warning: count(): Parameter must be an array or an object that implements Countable in

//if(count($this->_help)){ -- Original line of code retained for history

//Replace with the following line

if(is_array($this->_help) && count($this->_help)){
//That's all I did

echo "<script type=\"text/javascript\">\nvar help = Array;\n";
foreach($this->_help as $key=>$data){
echo "help[$key] = [\"$data[0]\", \"$data[1]\"];\n";
}
echo "</script>\n";
Sorry, only registered users may post in this forum.

Click here to login