mt-search.cgi and mySQL
Per an email question (and so I don’t forget where it is), if you are using MT-Search and mySQL in MT 2.2, you have to make one little change in mt-search.cgi to get it to work.
<update>When the urls for the MT forum change once again, breaking my newly-changed link, the fix is also listed in the comments for this entry.</update>
<update>Jay has released MT Search v1.31b, which incorporates this fix, as well as adding a number of other cool new features.</update>
Yep, that did it. Thanks a ton. I looked in the help board, I guess I just missed it.
Jason
Have you given any more thought to a good way to log searches? The random scrap of code I posted in that thread was (clearly) lifted from some other script, and I can’t get it to work.
Actually, I forgot all about it until I needed to track that thread down. I’ll try to keep it closer to the top of the stack, but I’m not sure I’m good enough to do it the way it should be done. Seems to me that it would be best if it stored searches as MT objects, so that they would be conveniently accessible to plugins and tmpls (I’d like to be able to do a tag to list the last ten searches, or be able to put a ”five most recent searches” list below the ”five most recent comments” on the blog editing screen), but I’ve never really looked at if/how you can define, store, and retrieve your own objects. To do.
Oh, after I wrote about the problem I was having, I realized that the links were pointing to my monthly index only, not the permalink anchor link.
I dug around in /mt/extlib/MT/mods/Search.pm and found the line of code that I *think* controls it (right at the very bottom):
$result_data{’MTENTRYLINK’} = $blog->archive_url . $sep .
$entry->archive_file . ’#’ . (sprintf ”%06d”, $entry->id);
I tried replacing the section ”(sprintf ”%06d”, $entry->id)” with just ”$entry->id”, but it doesn’t pad the zeroes.
Any ideas?
That should be sprintf(”…”, $entry->id);, with the stuff inside the quotes being ”% 0 6 d” (only without the spaces – I can’t remember the ascii code for a percent sign so it won’t get eaten by the textarea). Just need the ( after sprintf rather than before.
Now that the help board archive db is broken, broken, broken -but much faster than before ;)- could you post the ’little change’ required to make MT search work with 2.21 on here ? It’s driving me crazy with its failure to do the do …
I thank you from the bottom of my heart.
That was plenty hard to find: even though I knew exactly what was in the thread I wanted, it took half a dozen sets of search terms to finally find it with ”search.pm mysql”. What you need to do is change one line in Search.pm, from
$self->{’mt’} = MT::App::CMS->new( Config => $param{’mtconfig’} );
to
$self->{’mt’} = MT::App::CMS->new( Config => $param{’mtconfig’}, Directory => ’/full/path/to/mt/directory/’ );
where /full/path/to/mt/directory/ is the local filesystem path (something like /home/users/phil/philringnalda.com/mt/) to the directory with mt.cgi and more importantly mt-db-pass.cgi.
Aha…! Multithanks to you for digging that one out (bumping into forum mislinks all day myself)
gee, I hope they fix the board again….
Happiness is now mine searchwise :)
I just upgraded to MT 2.2 and installed the 1.31b upgrade and I’m having a problem. My MT directory is onegoodmove.org/movabletype and my blog is in onegoodmove.org/1gm The search engine looks in 1gm for mt-search.cgi instead of in movabletype where it should. Any help will be appreciated.
Please ignore that post. Duh!
MT-Search Version 1.31b released
Due to the big changes (particularly in regards to MT v2.2), I have released an upgrade to MT-Search. The