Hybrid CMS and Taxonomies: A Deep Dive into dotCMS Search CapabilitiesDec 02, 2019
When choosing a CMS solution, one of the most critical things to look for is powerful search capabilities. That’s because companies are producing an overwhelming amount of content, and the ability to find and retrieve this content is essential for achieving positive business outcomes.
Let’s look at why search capabilities are crucial for a CMS, and how dotCMS provides powerful search features out of the box.
Why Search Is Critical For Marketers
The ability to find and retrieve the content that marketers, developers, and even website users need is critical. If employees can’t access the content they need, then their ability to deliver rich digital experiences is hindered. That’s why content silos — lost or hidden content — is hugely detrimental, and search capabilities are critical to company success. On the frontend, users will want to search through the content to find what interests them most, so robust search capabilities are crucial for better customer experiences as well.
dotCMS Search In-Depth
dotCMS handles frontend and backend searches differently so you can achieve optimal results depending on the task at hand. The frontend uses the Site Search feature so your website users can search for content that interests them. The backend has multiple search tools for marketers and developers to find the content they need to deliver digital experiences. Let’s take a closer look at each.
Site Search Feature
Site Search is a feature to create and search indexes for different groups of content by leveraging Elasticsearch. These indexes are separate from the main content index that the other search features use.
Note: Site Search is only included with the Enterprise Edition.
What’s Included within an Index?
Site Search indexes only include pages, files, and URL mapped content. In general, only text which is displayed on a page or within content and files is included. The indexes are also not permissioned, and will only include content accessible by the Anonymous user role. That means the pages you attempt to index must be publicly viewable.
How You Can Create Indexes
From the Site Search sidebar, under the “Indices” tab, you can select “Create Site Search Index”, choose a name, and enter an Elasticsearch shard value or leave the default value if you’re unsure.
Next, you need to populate the index by running or scheduling a job under the “Job Scheduler” tab within the site search sidebar. The hosts you select must by live sites, and you can drill down to certain areas of each site by specifying particular paths to include in the index. Indexes can also be scheduled using a CRON job to specify the frequency, and alias settings are useful to ensure each new index gets saved. You can view your scheduled jobs later under the “View All Jobs” tab.
Searching Your Index For Content
Once your job has completed, you can easily search the index under the “Search” tab using basic text searches. The search feature will automatically generate an Elasticsearch query, run it against your index, and display the results as seen below.
This is a useful way to generate the appropriate query for use later on with the Site Search Viewtool when building the frontend of your site. You can also use the site search tool on the backend to verify frontend users are retrieving the correct results.
Auditing Job Data
The “Job Audit Data” tab is an advanced section that allows you to tune the performance of indexing jobs. This is crucial when you frequently publish new content that you want searchable on the frontend and need to update your indexes consistently.
The Query Tool allows developers to perform content queries using Lucerne Elasticsearch syntax. This will find matches for any searchable field within all your content, not specific indexes like the Site Search Tool.
ES Search Tool
The ES Search tool is similar to the query tools, but it lets developers use full Elasticsearch JSON query syntax to retrieve content. You can also limit the search to only include content that’s currently live on your site.
The results come back in a format that’s easier to read, but you can also get the raw Elasticsearch response as JSON at the bottom of the page. The response is useful for developers to use when building frontend applications.
Pulling Content With Velocity
Just like with the visual search tools, dotCMS has multiple options for pulling content from within Velocity scripts. These are useful Low Code features for integration with frontends without using APIs or other points of integration.
Site Search Viewtool
Similar to the Site Search Tool, the Site Search Viewtool allows developers to perform frontend searches using Velocity scripting. Using this Viewtool, therefore, developers can add Velocity scripts to any page on the frontend to give users the option to search specific portions of your website.
The most common way to pull content using Velocity will be with the pull method. You can use the $dotcontent.pull method to specify basic Lucene syntax queries, and map the results to frontend components.
There are additional methods covered in-depth within the dotCMS documentation such as $dotcontent.query, $dotcontent.count, and $dotcontent.find as well.
Once you’ve retrieved the appropriate Elasticsearch query using the ES Search Tool, you can use the query within Velocity scripts on the frontend with the ES Viewtool. This allows developers to perform more complex queries using full syntax rather than simple Lucene queries with standard content pulls (ie. $dotcontent.pull method).
dotCMS: Searching Made Easy
dotCMS recognizes that finding and retrieving content is one of the most critical capabilities of a CMS. That’s why the platform provides a multitude of search options for marketers, developers, and site users alike.
Marketers can efficiently retrieve and use the content they need to deliver digital experiences, and developers can seamlessly integrate content within the frontend interfaces they build. Further, site users can easily find the content that interests them most. These dotCMS search features, therefore, combine to create the best customer experiences possible.