A Low Search Primer
Ever since I released Low Search, I’ve been meaning to write a couple of blog posts about it. So, file this under “better late than never”, here’s a Low Search primer for those of you who are unfamiliar with it. Hopefully you’ll grasp its concept and understand why it’s the search add-on of choice for (amongst others) devot-ee.com.
Searching vs. Filtering
When searching with Google or your search engine of choice, you’re searching for web pages. When searching in ExpressionEngine, you’re not searching for pages, but entries. In fact, you’re already “searching” for entries when you define parameters in the channel:entries tag. Therefore, you could say “searching” equals “filtering” in ExpressionEngine. Bear this in mind for the following.
Natively, ExpressionEngine lets you filter entries by many parameters. Entry properties like channel, category, status, and so on. You can even use a search:field-parameter for very specific filtering. However, if you want to filter by keyword, you’re gonna have a bad time, because ExpressionEngine simply isn’t optimized for it.
Low Search changes this by introducing Search Collections. Per collection, you select a channel, searchable fields and more. You then build the collection index, which consists of an optimized version of all the entry’s content. For example, all HTML and punctuation is stripped out, diacritics are removed and weight is applied on a per-field basis. To this index, a Full-Text database index is applied, making queries targeting it very fast indeed.
So that’s keywords covered. What about the rest of the search properties? Here’s where Low Search really shines. Apart from it’s own parameters, you can add any amount of channel:entries parameters as input fields to the search form. These parameters are applied to the Results tag, allowing for very customizable search results. For example, change the number of search results by setting the
limit; refine the results by changing the
category, similar to faceted search; include or exclude entries based on any pre-defined custom field using Low Options… And because these parameters are encoded in the URI, the search results pages are bookmarkable and shareable.
Ranges and Relationships
Then there’s a couple of custom parameters you can set. Ranges will allow you to define a numeric or date range for any custom field, limiting results to entries that fall in the range you define. Relationships will limit results by entries that have the child or parent IDs you define, and it supports both native and Playa relationships. Check out the advanced form tag example to see how easy it is to set up.
That’s a lot of words to explain the concept of Low Search. I bet some of you would rather just see a couple of examples. Well, I agree. The next blog post about Low Search will contain just that. For now, you can leave a suggestion for an example you would like to see below in the comments.