Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Problem with search - no results after moving to a new host
Please read this post first.
Recently I changed hosts and seems the search stopped searching in the process. At first I thought it was some encoding problem (as I wrote in the other thread), but it appears that’s not the problem, according to Sencer.
So what information do I need to post that could help solve the problem?
ps: I still think some DB messup happened during the move, as previously all the posts in the blog were readable in phpMyAdmin and now they are a bunch of weird characters…
Last edited by Boby Dimitrov (2006-10-17 13:38:52)
Offline
Re: Problem with search - no results after moving to a new host
What mysql-version were you using on the old server?
Please post the diagnostic information from the new server.
Doe the posts themselve appear correctly on the new server, i.e. on the pubic side, or when editing in the admin-side?
Offline
Re: Problem with search - no results after moving to a new host
Old host: 4.1.21-standard
New host: 4.1.21-standard-log
The posts appear correctly in the TXP admin (when editing) and on the public side (link in my profile, but it is all in Bulgarian). I just made a test posting to see if new posts are searchable; alas they are not…
Here’s the diag data.
Last edited by Boby Dimitrov (2006-10-16 13:23:52)
Offline
Re: Problem with search - no results after moving to a new host
Your problem has othing to do with the server-move. It’s because you are using the development version of textpattern. In the revision you have we had switched to using the mysql-fulltextindex for searching, which is a lot faster than the old method. We’ve sinced reverted to the old method for now (1918), because of other issues that will take some time to look at.
Because you have utf-8 data in latin1 tables, the fulltext index does not understand cryllic characters at all, hence why you get no results. Having utf8-data in latin1 columns in mysql is nothing inherently bad though, up to a while ago, that’s how probably large chunks of the web worked, because utf8 was only introduced in mysql with version 4.1 (and your textpattern installation is probably from a time before your host switched to mysql4.1).
Anyway, for now updating to a more recent development version will make things work again. In the long term, you probably want to migrate your data over to utf-8 tables, there’s a topic on how to do here:
http://forum.textpattern.com/viewtopic.php?pid=127115#p127115
Offline
Re: Problem with search - no results after moving to a new host
Thanks, I’ll try to update the RC1 to the latest development version and see what happens (although I still don’t quite know how to do that).
One more thing, do you know if this table-rebuild-magic can be done on a shared hosting (as most of us host, I guess). I see some stopping mysql (?!), deleting some log files (which I’m sure are not accessible on a shared host), editing the mysql configuration files…
Is there any easier way to do all this?
Offline
Re: Problem with search - no results after moving to a new host
Thanks, I’ll try to update the RC1 to the latest development version and see what happens (although I still don’t quite know how to do that).
Oh, ah, RC1, I forgot about that. Hold on for a day or so, 4.0.4 should be out very soon now.
Well, he’s explaining the procedure for a more complicated setup, most of the stuff doesn’t apply to a simple setup like ours. I’ve commented on this in my post in the other thread where I link to it. The important steps are:One more thing, do you know if this table-rebuild-magic can be done on a shared hosting (as most of us host, I guess). I see some stopping mysql (?!), deleting some log files (which I’m sure are not accessible on a shared host), editing the mysql configuration files…
- backup structure and data seperately. Make sure, they work and are not missing anything and you know how to restore things (or try in a second database, just to be sure).
- drop the tables
- edit the table structure in your dump
- reimport tables
- reimport data
Don’t do this on your live-data if you do not feel secure about doing so and dealing with problems.
Offline
Re: Problem with search - no results after moving to a new host
Just to follow up. What I did:
1. mysqldump -d -h localhost -u -p DB_NAME > schema.dump (get the tables structure)
2. mysqldump -h localhost -u -p DB_NAME —no-create-info —compatible=mysql323 > data.dump (get the raw data, according to the blog post mentioned)
3. Edit schema.dump and replaced “DEFAULT CHARSET=latin1” with “DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci”
4. Then created new database with CREATE DATABASE NEW_DB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
5. Imported the schema with mysql -h localhost -u -p NEW_DB < schema.dump
6. Imported the data with mysql -h localhost -u -p NEW_DB < data.dump
7. Edited config.php and set dbcharset=utf8
8. Checked diagnostics:
Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
19 Tables: OK
Seems OK. But… My site looks like $h1t. So, what I did was comment out the dbcharset value in the config and now the site looks OK and what’s more important – the search now works!. The diagnostic reports the expected problems, however:
Charset (default/config): latin1/
character_set_client: latin1
character_set_connection: latin1
character_set_database: utf8
character_set_results: latin1
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
19 Tables: txp_textpattern is utf8, txp_txp_category is utf8, txp_txp_css is utf8, txp_txp_discuss is utf8, txp_txp_discuss_ipban is utf8, txp_txp_discuss_nonce is utf8, txp_txp_file is utf8, txp_txp_form is utf8, txp_txp_image is utf8, txp_txp_lang is utf8, txp_txp_link is utf8, txp_txp_log is utf8, txp_txp_log_mention is utf8, txp_txp_page is utf8, txp_txp_plugin is utf8, txp_txp_prefs is utf8, txp_txp_priv is utf8, txp_txp_section is utf8, txp_txp_users is utf8
Last edited by Boby Dimitrov (2006-10-17 13:42:24)
Offline
Re: Problem with search - no results after moving to a new host
Hi Boby,
that is very odd. I’ve sent you an email (I can look at the files if you like). I’d like to get this solved.
When you add new posts now (with the “bad” diagnostics output), do they show up ok? What happens when you edit older posts?
Offline
Re: Problem with search - no results after moving to a new host
Adding new posts works. Editing old posts works. All new and old (edited or not) are searchable.
Offline
Re: Problem with search - no results after moving to a new host
Hi Boby, I found the solution. Because your mysqld-server is configured for atin1 by default, that is also what mysql uses when importing your data.dump. So to fix it you have slightly change step 6 and add --default-character-set=utf8.
…
5. Imported the schema with mysql -h localhost -u -p NEW_DB < schema.dump
6. Imported the data with mysql —default-character-set=utf8 -h localhost -u -p NEW_DB < data.dump
…
(Alternatively adding SET NAMES utf8; at the beginning of the data.dump file works as well, however the danger here is that a non-utf8 compatible editor can mes up the data.dump file when saving. On the command line you can use: echo "SET NAMES utf8;" > new_data.dump && cat data.dump >> new_data.dump which will give you a new file new_data.dump that has the necessary line at the beginning. This file should then also be importabe via phpmyadmin, theoretically).
Now setting config.php to utf8 will work. And your data will be correct in mysql. (Meaning the dump you have and sent me is A-OK).
Thanks. Hopefully your demonstration above will be helpful for other people as well. I’ll test it again with a fresh install on msql3 and upgrade to mysql4.1 and if it works (it should), I will add it to textbook. :)
Last edited by Sencer (2006-10-17 16:13:07)
Offline
Re: Problem with search - no results after moving to a new host
As we talked in GTalk, I’m reporting back.
This solution works!
1. All posts are searchable – new and old alike (tried editing old ones too).
2. Finally I’m able to actually read the posts in phpMyAdmin (in cyrillic).
3. Diagnostics checks out:
Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
19 Tables: OK
I hope this will help other users… And thanks Sencer!
Offline