Published by Mijingo

movie icon image

ExpressionEngine How-to Articles

Topics range from beginner to advanced, but are all born out of real world, professional, day-to-day use of ExpressionEngine. Need more information? Get training videos and ebooks on ExpressionEngine from Mijingo.

The (not always) Simple Search Form

If you’ve implemented the Simple Search Form before, you’ve probably come across this. For me, it’s the small thing that I usually forget until I go to test some search terms to make sure the search functionality is working as expected and the results have the proper URLs.

So what am I talking about?

The search_in parameter. The Simple Search Form defaults to only searching in the entry titles of the weblog(s) you specify. It says so right there in the documentation:

If this parameter is not set, the search will default to only search by “titles”.

It doesn’t make much practical sense to me that the default behavior for site search would be so limited, but there it is. It does make technical sense; the more limited the search, the faster the queries.

There are three possible values for the search_in parameter:

1. entries: The search will be conducted in the entry fields and titles of your weblog. The associated comments will not be included.
2. everywhere: The search will be conducted in the title, entry fields, and in associated comments.
3. titles: The search will be conducted in the title of your entries. The weblog entry fields and any associated comments will not be included.

A good value to use is entries, as that allows your site visitors to search in all of your weblog fields (as long as you allow it explicitly when setting up the custom field) but doesn’t burden the search with searching through all of the comments of your entries.

Here’s the Simple Search Form EE code for this site:

{exp:search:simple_form weblog="blog|articles|videos"
result_page="search/results" search_in="entries"}

. . .


Posted on Jan 15, 2009

Filed Under: How-To, ExpressionEngine Development,

Ryan Irelan
About Ryan Irelan

Ryan Irelan is the Technology and Development Director at Happy Cog, a web design and development firm. He is a noted ExpressionEngine expert, having created a wildly popular video training series on ExpressionEngine. Additionally, Ryan is the publisher of EE Insider, a well-known news and information site for the ExpressionEngine community. In his spare time, Ryan is the production director of A List Apart Magazine, which is one of the most popular ExpressionEngine-powered sites on the web. Recently, Ryan published a book on ExpressionEngine 2 called "ExpressionEngine 2: A Quick-Start Guide."