MTSearches in a container tag that will go through all the of the searches that have been made on your site.
Here's how I use it:
Recent Searches:<br />
<MTSearches lastn="8" unique="1">
<a href='<$MTCGIPath$><$MTSearchScript$>?search=<MTSearchValue>'>
<MTSearchValue></a><br />
</MTSearches>
<br />
Top Searches:<br />
<MTSearches lastn="10" rank="1">
<MTSearchRank>. <a href='<$MTCGIPath$><$MTSearchScript$>?search=<MTSearchValue>'>
<MTSearchValue></a>
(<MTSearchTotal>)<br />
</MTSearches>
Download recentsearch.tar.gz or recentsearch.zip , unpack it, and place recentsearch.pl in your plugins directory.
MTSearches
- container tag for the list of searches that are pulled from the log
- arguments
- days: to include searches from only the last n days (e.g. <MTSearches days="7">)
- lastn: to include n searches in the list (e.g. <MTSearches lastn="5">), if no other arguments are giving, these are just the last n searches
- unique: to include only the latest instance of a particular search (e.g. <MTSearches unique="1">)
- rank: orders the searches by rank, the most common being the first (e.g. <MTSearches rank="1">), implies unique
MTSearchValue
- the value of the current search
MTSearchDate
- the date of the current search
- takes one argument, format, used just like MTDate
MTSearchIP
- the IP from which the search was requested
MTSearchTotal
- the number of times this specific search has been made
MTSearchRank
- the rank of the search overall, 1 being the most common
ChangeLog:
- Version 0.61: Bugfix: Now it works in December
- Version 0.60: Added days to MTSearches
- Version 0.52: Added MTSearchTotal, MTSearchRank, and rank to MTSearches
- Version 0.45: Added MTSearchIP and unique to MTSearches
- Version 0.35: Fixed month+1 bug
- Version 0.31: MTSearchDate now adjusts itself to the local timezone of the blog
- Version 0.3: Added MTSearchDate
- Version 0.2: Added lastn to MTSearches
- Version 0.1: First version!
Umm, the file link is broken...
When accessing it via the archives...
Whoops. :) It should work now.
Great! The addition of MTSearchDate is very useful. One question, though: my timestamp for each search is in GMT, and not my local timezone. Is this because the Search log is kept in GMT? If so, is your plugin designed to adjust the time according to the user's timezone?
thx
-phil
Yes, from what I can tell, the log stores its Dates in GMT. I'll see what I can do to convert them to the current blog's timezone.
Much appreciated.
I had posted to the MT support forum about this before. My time zone is OK, but the dates are still in November instead of October. I've installed version 0.31 and rebuilt.
All better. :) I have no idea what happened; I guess work has gotten me more distracted than I thought this week. I can't believe I actually missed that.
Aside from limiting the number of search strings displayed, how about an option to limit the strings displayed to only searches for a certain blogID?
Is this a bug in MT's search functionality, or just something to add to your plugin?
I love the plugin!
-Rick
As far as I'm aware, the search entry goes into the Log without any mention of which blog the search was performed on or from. Without changes to the log or mt-search, I don't think there is much I can do to implement a blogID limiting parameter. I'll think on it though.
Great you saved me some sleep! I had hacked Jay's script to do basically the same thing and was not looking forward to diving into MT to recreate the logging (I'm not real good with OO code). I have a couple of improvements to suggest if youre the adventurous type:
Since it's almost already there add MTSearchIP tags
Some way to drop duplicate search terms like an alternate MTSearchValueUniq tag
A MTSearchToday tag that will only return searches done on the same date or within 24 hours of now.
A method of filtering unwanted (possibly naughty) terms by way of a config file.
A method for ranking searches i.e. top 10 terms over x amount of time
Just some thoughts if youre like me youre too busy to mess about for hours at a time. If I get around to it before you do I'll slap some code up here. But that will be another day.
Again thank you for putting this up!
Psyber
Just my 2 cents (actual worth may vary)
Great work on a great plug-on!
Quick quesiton, I host multiple blogs on the same installation of MT and would only like to show the search terms from my blog, is that possible?
Hmmm... 0.6 doesn't seem to like Decemeber much:
Month '12' out of range 0..11
Cool plugin when it works though.
Thanks for fixing the "December-bug"! It's working great now.
i noticed on your site that after you make a search and then reload your homepage, that search term is in your recent search list without the page rebuilding. how are you getting the list to reload without the template rebuilding if you wouldn't mind sharing a little bit more :) some sort of include?
thanks
That's actually thanks to a little hack I made to the MT::App::Search package. It rebuilds the indexes, but it forces the person performing the search to wait for the rebuilding to finish before the results are returned.
David, I've been using the plugin successfully since shortly after release and I noticed just now that the search data wasn't visible. When I went ahead and searched, my new search appeared, but the results appear to have "reset themselves"; I'm assuming they'll start over from zero. Fine with me, but I'm wondering if you might have a guess as to why?
Help!
Liked yr plugin: however, some 'helpful' joker wrote a script to test-pummel my server.
Without telling me he was going to do this, of course.
Now, I don't know where recent search results are actually stored to delete the 100 searches he did in 10 seconds.
LI'L IDEA: Can I cap the number of identical searches that get shown to stop this happening by a genuinely malicious user or even people who wanted to graffitize this function? ie searches more than say 20 are not displayed? This would have the added beneficial effect of stopping top searches reinforcing themselves and wearing a groove into yr site instead of opening up new crevices
found by visitors, which, as I understand it, is the cool thing about this plugin.
TIA
Patrick
were you ever able to fix the GMT timestamp issue?
were you ever able to fix the GMT timestamp issue?
sorry for the double. it errored out on me :(
David, did you document the MT::App::Search hack, the one that rebuilds the indexes before returning the search results? If so, I would like to implement that hack at my site. I probably could figure it out on my own, but if you already did the work... :)
Um...nevermind...I figured it out myself. Lot easier than I expected. Thanks anyway!
David,
I put in the hack successfully last night, but it looks like I don't get the page to "rebuild", which by reading the comments here, something was done to MT::App::Search. Can you give me some insights here, as now on my page nothing changes if you hit refresh after searching....
Thanks for your help!
Is it somehow possible to limit the the clickable part of the links? I currently have the problem that a very long searchstring without any spaces screws up the design. So I would like to limit the amount of characters of MTSearchValue displayed.
Is it somehow possible to limit the the clickable part of the links? I currently have the problem that a very long searchstring without any spaces screws up the design. So I would like to limit the amount of characters of MTSearchValue displayed.
Is it somehow possible to limit the the clickable part of the links? I currently have the problem that a very long searchstring without any spaces screws up the design. So I would like to limit the amount of characters of MTSearchValue displayed.
Is there a way to rebuilt the site automatically?
I read a lot about hacks and all that stuff but I didn't find anything about it on the net.
This script is great, and I've been using it on my site as a way to track tag usage.
Any way to separate out the results by blog id? What if you have more than one blog using mt-search?
Thanks.