I use the Spotlight feature in OS X an awful lot. While some people would rather use things like Quicksilver, I like just hitting command+space and typing in what I’m looking for, be it a document or even an application I want to open.
That’s the inspiration for AJAX.search, a search system built on Prototype’s AJAX framework. It will make a call to a URL you specify and display the results under your search box like Spotlight (and now, like the search at Apple.com). From there you can hit the up or down arrow keys to select a result and then hit the enter key to visit the link.
I also built a Wordpress plugin that uses AJAX.search in the default search box, and in fact you can test it out on this site’s search box right now. By default the plugin will search all your posts and display them in the results grouped by category.
If you want to try it out on your Wordpress install, you can download the plugin here. There are still features I still want to implement, and it may not work on all Wordpress versions (I’ve only tested on version 2.2.1). Eventually there will be a configuration page in the admin to allow you to change a few settings, such as number of results to display and whether to show categories in the results.
Download the AJAX.search Wordpress Plugin version 0.1
If you’re using K2: make sure you turn off Advanced Navigation in the K2 options, since K2 has an AJAX search function that will collide with this one. If you want to keep Advanced Navigation on, you’ll have to comment out the Javascript in the K2 header file that sets up the K2 AJAX search.
hello tried to install the plugin …
but i get coupla errors …
Warning: main(/home/nashydhu/public_html/wp-config.php) [function.main]: failed to open stream: No such file or directory in /home/nashydhu/public_html/blog/wp-content/plugins/ajax.search/ajax.search.php on line 11
* Snipped by editor *
guess i’m mesing something up somewhere eh ?
wanna help out a bit …?
thanks …
@subcorpus: Ah, I didn’t think about having a blog in a sub-directory! I made a fix to the plugin and uploaded it. Try downloading the new version and trying again.
w00t! Going to use this bad boy and going to tell my peeps about it. Nice work on this, Matt!
Hi there, im a bit confused, i have installed the plugin correctly (also on 2.2.1), but its not working for me, hust the old search box…
http://www.gport.nl/blog
any ideas?
Btw, all i did was upload to the plugin folder, and activate the plugin.
Or do i need to put code somewhere to make it work?
I love this plugin! Is there any way to add a close button? Let’s say, somebody doesn’t like any of the search results but doesn’t want to click on any of the links to close the ajax box, would it be possible to close that box via a small button/”close” link?
I agree with Mike! I close button is required. The ESC key does the trick, but only sometimes. Other times to get rid of it you have to reload the page entirely. Great implementation, except for that one thing.
At Apple.com you can hit ESC or click outside of the search results DIV to dismiss the search results overlay.
I added it to my site http://christhis.com/ but I had some major CSS issues. I had to remove the -120px from #search_results because it was off the left side of the page. It doesn’t position itself below the search box, rather to the left of the page.
Also, all the fonts were super huge… I had to modify #search_results dt/dd by adding a font-size and font-weight.
I tried making it wider, too, but I didn’t get very far… was hard to control the width. I’m going to leave it up there for now in hopes that I can resolve the positioning issue.
btw, quicksilver is ctrl-space or whatever you like, instead of cmd-space ;), it’s just a customizable spotlight…. that’s why its better
thanks for the plugin!