When enterprise search was added as a new feature to Ektron’s CMS version 8.5, the benefits were immediately evident. Fast, accurate searches were attainable not only on your website, but also within Ektron itself. And Ektron’s search functionality has gotten even better with the recent release of v9.0. Now developers have the option of using either Microsoft Search Server or Solr search as their search provider.
Unfortunately, most websites I see limit search to one area only—performing text-based searches in the search bar. It’s a shame, because Search gives you a powerful set of tools to query your site easily and efficiently. It’s not a replacement to the API, but rather a complement that does the heavy lifting which would otherwise strain the API. Another hidden benefit is that it’s free and already installed with Ektron, so why not get as much as you can out of it?
During my 7+ years working as an Ektron developer, I can say the added power of the Search functionality is one of the most exciting and valuable enhancements of the product to date. The goal of this article is to outline the power of search and give you a few ideas about how you can begin using it within your own websites.
A Common Problem
To illustrate, we will use the example of news articles on websites. Let’s say we start from scratch and in our first year we create 1,000 news articles for our site. Chances are that querying news articles on different criteria like date, category or title will still be very quick (fractions of a second). But what happens when we produce thousands more articles over the next few years or have a lot of archived content from previous years. There could be 50,000 or even 500,000 articles in our system. You will notice that the same queries perform decidedly slower than before. In fact, it’s so much slower that it affects the performance of pages and delays loading times by seconds. Sound familiar?
The reason these queries are not scaling well over time is because they are directly tied to the quantity of the content they are searching. In order to find out what news articles meet the specified criteria, all records need to be inspected on the appropriate fields.
Search to the Rescue!
Under the exact same scenario, a product like Microsoft Search Server or Solr can filter through all of your news articles and give results in fractions of a second. How? By indexing your Ektron data and querying on those indexes. What is an index? A thorough definition can be found here. But the simplest way to think about it is essentially the same way indexes work in a book. If I need to find a particular topic or category, the index tells me what page to go find it on. Otherwise, I would need to scan through the whole book looking for that information, page by page.
The same applies to database indexing. Although the actual implementation technique of an index can vary, the important part to take away is that we only have to look through a fraction of the data to get our results—not all of them. When I enter content into the Ektron work area, I can specify what fields need to be indexed. This can include different types of information such as smart form fields, metadata, and taxonomies.
What’s more is that queries running through providers like Solr or the FAST version of Microsoft Search Server yield another powerful mechanism: facets. Facets are a list of filters that can be used to further refine your search results. You’ve no doubt seen facets when shopping at an online retailer like Amazon. These are the sub-categories that appear to help you refine your original search results. Facets are returned at the time of the original search request and do not require additional steps or programming to populate.
When Should You Use Search?
- Anytime queries need to be performed on large sets of data. As outlined above, we can avoid sifting through all the records in a table or set of smart forms through search.
- Anytime you need to perform aggregate functions within smart forms or need to query on tabular data within a smart form. Operations such as finding out what event has the most attendees or which users have multiple phone addresses should be done with search.
- When searches need to be performed on multiple data sources. Through federation, search can find and return data from your Ektron database, your SharePoint sites, and other web sites. It can even crawl and return data from central applications such as accounting systems or CRM systems.
- When filters may need to be applied on your original results. Especially if those filters are context sensitive and only apply to certain types of search results. For example—filtering by author is applicable to books, but not all types of products.
When Should You Use the API Instead?
- When looking up a single record in the CMS or querying a limited amount of data. API is faster in these cases because Content IDs are already indexed in the CMS database. In addition, search has slight overhead that is unnecessary for searching over a small amount of records (hundreds or a few thousand).
- When real time data is essential. In order for a product like Search Server to index databases, it has to crawl over the data and re-index as needed. This is done in the background and incurs a delay. This can be anywhere from a few minutes to hours depending on the amount of data that needs to be indexed and the frequency of the crawls. A more frequent crawl schedule can reduce this delay to just a few minutes. But cannot guarantee real time results.
- When user generated content is involved. For the same reason as real time data, a user entering in a comment or poll results will not have them immediately available through search. Instead, the API must be used because it is querying the data as it is entered into the system.
The Ektron Framework Search API
Building upon our earlier news example, you can begin to see how a news article lookup page could be constructed using search. The Ektron Framework API offers 2 different types of searches: the keyword search and advanced search. Using a keyword search, you can quickly and easily find search results by simply specifying a string of text. This is the same functionality that you are used to seeing in a search bar within sites.
However, advanced search allows you to find content based on the specific data within your CMS. So we could easily find all articles by a particular author or within a certain category. Furthermore, you can quickly group content that relates to a field within a set of data—smart forms for example. Imagine a smart form for event details. You could store a list of attendants to those events within the form. The list could even be its own smart form. Search would allow us to perform some very powerful queries such as all of the events that a user attended, the type of events they frequently attend, or even the times of the year that they are most likely to attend events.
In an upcoming article, I will walk through a technical demo of using the Ektron Search API. I am taking requests. If there is a specific example or task you would like me to tackle, please submit it in the comments below.
About the Author: John is a .NET CMS architect working on Celerity’s Web and Mobile Solutions team. He’s been furiously developing in Ektron for over 7 years and was the architect of the 2008 Ektron Site of the Year.
See how we used Ektron to develop a socially-enabled intranet site, complete with all the bells and whistles to enhance collaboration: http://www.celerity.com/work/spotlight/?project=8