Published by Mijingo

movie icon image

EE Insider Blog

Spend your time learning and developing sites with ExpressionEngine and we'll use this blog to keep you informed of all the news related to ExpressionEngine and CodeIgniter.

» Read more in the Archives.

» Have a tip? Send us your EE news.

Learn ExpressionEngine Today

Over a series of 8 videos, watch and learn as Ryan builds an entire ExpressionEngine website from beginning to end. Get started now.

Solspace Super Search Module

I think we’ve all probably run into the limitation of the built-in EE search at some point.  If you’ve wanted something beefier, more flexible and a lot faster, you might be interested in what Solspace has to offer.

Last week, they announced the beta release of Super Search, “a fast and flexible search module.” Super Search lets you use URL parameters to set the search query. This allows you to easily chain together different search parameters to find an exact result.

The architecture of the module borrows from Google’s model of constructing search queries. Anything that you might want to query for, keywords, weblogs, categories, statuses, custom fields, date ranges, custom field numeric ranges, etc. can be loaded into a single URI segment by using the Super Search syntax. This makes pages highly cachable, shareable, flexible and versatile. Values can of course be hardcoded using template parameters. But if you choose, you can also load all of your params into a single query string and provide that as a param. Forms can be created freely by you to submit queries to a results page and Super Search will translate the contents of the POST.

How it Works

The example they gave in their blog post about the beta release is about searching a classified site for a specific car make, model and price.

We also use the module quite a bit to search for entries where certain custom fields contain exact matches on some keyword. So on the same classified ad site, we might do this:

http://www.yoursite.com/index.php/search/results/search&price;-from=100&price;-to=500&exact;-make=Chevy&exact;-model=Camaro

This search would find Chevy Camaros that cost between $100 and $500 dollars.

You can filter on the weblog as well.

http://www.yoursite.com/index.php/search/results/search&price;-from=100&price;-to=500&exact;-make=Chevy&exact;-model=Camaro&channel=used_cars

The above search would find used Chevy Camaros selling for $100 - $500 bucks.

More Than Just Search

super-search-edit-field

The Edit Field tool in Super Search

The description of Super Search has it listed as part of the Solspace Performance Suite. This is because it allows you to finely tune your search in terms of caching and how your MySQL database is structured.

Super Search includes a utility that lets admins alter their custom weblog fields at the MySQL level. This is important since you can improve site performance by changing field types to use only the space you need. Example, if you have a field that always contain either ‘y’ or ‘n’, change it to a ‘char’ field and save tons of space.

Additionally, your users can save their searches and refer to them later. On the search results page you just enter in a name for the search and click Save.

super-search-saved-searches

Super Search Saved Searches (say that 10 times fast)

Clicking on those saved searches returns you to that search result. A great way to give users more functionality. It’s also an easy way for sites to build special archive pages of their content.

Show ‘n’ Tell

It’s not enough to just tell you about Super Search. Nope. I decided that I would implement it right here on EE Insider so you can try it out for yourself. I’ve set up a special search page that uses the Super Search module. On this page I’m also displaying content with Super Search instead of with the weblog entries tag pair.

Here’s the code I used to make that happen:

<ul>
  
{exp:super_search:results channel="articles" num="10"}
   
<li>{title}</li>
  
{/exp:super_search:results}
</ul

This should look somewhat familiar. I just tell Super Search which channel to use and the number of results. I then output the title of each article in an unordered list.

The current version of Super Search does not support the normal variables available in the Weblog Entries tag pair (like title_permalink or auto_path). If you wanted to link up the results to their view pages you would have to use the url_title variable (which is supported) and link it up manually.

The Wrap-up

I’ve only touched the surface of what Super Search does and what can be done with it. I encourage you to read the full documentation to get a fuller idea of the capabilities of the module.

Super Search is now in public beta and costs $84.95. If you’ve ever tried to build your own custom search module for EE, you know that $85 won’t even come close to the number of billable hours required to pull it off. In short, it’s a deal.

This module gets a big thumbs up from me. I look forward to using it more and seeing how it develops during the beta phase.

Thanks to Solspace for making the module available for EE Insider to test.

Posted on Nov 19, 2009 by Ryan Irelan

Filed Under: EE Add-ons, EE Modules

Michael Hessling05:22 on 11.19.2009

Not to mention, a custom Google search costs $$ (if you want to brand it as your own), too.

I’m curious, though: the module is compatible up to 1.6.8, but it’s using “channel” instead of “weblog”. That’s a neat trick.

Derek Hogue06:23 on 11.19.2009

Unfortunately this still doesn’t address the main problem with EE’s built-in search, which is that just because a piece of content lives in a single entry in the database, this does not mean that I ever want that entry displayed on its own (or that there even exists a template to do so). Section intros, listings of content (like links w/ descriptions), and other scenarios come to mind.

For very specific searches (say, search all products in a weblog), this method is great.  But for overall site searches, nothing beats a search based on an index of your front-end site (i.e. Google CSE, or the paid Google Site Search, which returns results in XML.)

Christopher Robert Kennedy08:00 on 11.19.2009

Michael, it’s really easy to change weblog to “channel” in 1.6.8. You can change the name so as to easily transition clients later to the term by editing the “section designation word” setting under the CP > Admin > System Preferences > General Configuration.

Briannotbryan08:03 on 11.19.2009

This sounds like it could be a more promising alternative to the standard module. This will certainly come in good use for future projects.

Michael Hessling08:25 on 11.19.2009

Thanks, Robert. I’m still chugging along on 1.6.7 (for my live sites). Locally? <grin>

John Faulds12:02 on 11.19.2009

The save a search feature seems a bit buggy. I used the advanced form and chose CodeIgniter as the option and got returned a series of six results and the save a search field had ‘search’ filled in the input.

So I clicked save and it saved my search as ‘search’, which is obvious when you think about it afterwards, but before doing it for the first time, you don’t realise you have to change the value of the input to what you just searched on; I’d expect it to be prefilled with that value.

So having saved a search called ‘search’ that says only has six results, when I click on the link, I actually get presented with a set of 344 results (presumably the number of results with the keyword ‘search’ in it).

If I then try and save that search as ‘Code Igniter’, thinking that the saved search uses the name you save it as for its keyword, it still gives me the same set of 344 results.

Chris Gill20:57 on 01.22.2010

Like John, I find the search itself works OK, but when a saved search is retrieved later I get 400+ results instead of the small number of results I got with the initial search.