All Low add-ons are now owned by EEHarbor. Read the blog post.

Blog

A Low Search Primer

13 November 2012 7 comments

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.

Search Collections

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.

Dynamic parameters

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.

Comments

  1. Rick Robinson 11 February 2013 at 17:30

    Low, is there a way to search across multiple channels? I have several channels feeding content to my site and would like an integrated “simple search” across them.

  2. Lodewijk Schutte 11 February 2013 at 17:36

    Just create a collection for each channel you want to search through. Then use the collection=”” parameter in the Form to choose which collection (channel) you want to target, or omit to search all collections (channels).

  3. Steven Hambleton 1 March 2013 at 04:06

    Hi Low!

    I have a product database and at the moment we’re allowing the title to be searched. It contains products like -> “Acme King Size Bed”

    Do you know if it’s possible to allow searches like ->
    “King Sized Beds”
    “King Size Beds” etc?

  4. Lodewijk Schutte 1 March 2013 at 10:17

    Hey Steven. You’re looking for the loose_ends parameter, which partially allows for it. With that, searching for “size” will return “sized”, but not vice versa.

  5. Carlos Romero 3 April 2013 at 01:11

    Hi there… I am using EE MSM, and seems impossible to create a collection that can search on both sites… My main request is to be able to search and display Site A news into Site B news…

    Is this out of low_search scope? Is there a workaround?

    Thanks in advance.

  6. Carlos Romero 3 April 2013 at 01:44

    Forget my last post..  I found how to do it by adding the site parameter.. However, it is not specified in the documentation that this parameter can be sent.

  7. Lodewijk Schutte 3 April 2013 at 08:19

    Glad you found it, Carlos. It’s not mentioned in Low Search’s docs, because the site=”” parameter is available in native tags. So just like there is no mention in my docs that you can use the status=”” parameter, for example.

Commenting is not available in this channel entry.