Locating Content
So far, you’ve learned about defining content types and capturing metadata. You’ve also seen how this metadata can provide important context when displaying content in site pages. This data is also critical for enabling users to efficiently locate content through search and other Liferay tools. Intuitive site layouts and navigation can help guide users to the pages and content you want them to see. However, robust search capabilities remains the most powerful tool for users to locate what they’re looking for.
By default, Liferay uses Elasticsearch as its search engine. As you add content to the system, Liferay indexes it with Elasticsearch so it becomes searchable through Liferay search pages. While discussions about search often focus on general search pages where users can find anything stored on the site, another crucial approach involves implementing content-specific search pages. This enable users to quickly browse and filter assets of a particular type.
Here you’ll explore general principles for leveraging search for content-based solutions.
Search Fundamentals
Liferay search relies on Elasticsearch for indexing, storing, and retrieving data efficiently at scale. You can base queries on the specific words entered by users in a search bar and supplement queries using additional search facets. Facets enable users to filter their results based on metadata stored in the search index. For example, you can allow users to filter content and assets by its creation date, the last time it was modified, or the folder where it is stored.
Type Facet
Perhaps the most fundamental search facet is the type facet. It enables filtering by the various types of content and assets indexed by Liferay. Here are some key types of indexed content:
- Web content articles and folders
- Documents and folders
- Pages
- Other types of content (e.g., blogs posts, knowledge base articles)
You can also extend available types using custom objects and custom assets.
Other Facets
Liferay includes a wide range of other out-of-the-box facets to support filtered searching:
- User Facet: Filter by the author or creator of the indexed entity.
- Modified Facet: Filter by the last modification date of the indexed entity.
- Category Facet: Filter by categories associated with the indexed entity.
- Tag Facet: Filter by tags associated with the indexed entity.
- Folder Facet: Filter by folder name for indexed entities like documents and web content.
- Site Facet: Filter by the site the entity belongs to.
Since facets filter based on available metadata in the search index, not all content will have information for every facet, as the metadata may not be applicable or needed.
Filtering by Field Data
Beyond default facets, Liferay search can filter by almost any data stored in the underlying search index. This includes filtering based on specific web content or document fields. You’ll learn how this works in the following section on building search pages.
Building Search Pages
All search pages in Liferay are built using multiple out-of-the-box widgets. These are page elements that provide specific search functionality. At minimum, a search page requires the Search Results widget to display results and the Search Options widget for configuring search behavior. Most search pages also include a Search Bar widget (for user queries), a Sort widget (for ordering results), and one or more Facet widgets (for filtering). The specific usage of these widgets is flexible, so you can tailor the search experience.
Liferay provides a default search page for every site named ‘Search’. The search bar in the default page header redirects users to this page for queries. This default setup serves as a basic example for building your own search pages. Administrators can also customize this default page by configuring or adding/removing widgets. For instance, you can configure the Type Facet widget to limit which types of indexed entities to include in results. Clarity’s own implementation does this to restrict general search results to articles and documents, instead of including users, products, or other items.
Content-Specific Search Pages
In additional to general search pages, Liferay’s extensive search tools and configuration options facilitate the creation of content-specific search pages. These pages typically begin by displaying all items of a given type, allowing users to then search or filter the results. For example, a storefront might display all products, which users then refine with filters. Clarity applies this approach for its product list page, showcasing all products and enabling users to filter by category and other criteria (e.g., sunglasses, lenses). Other examples include search pages for blog articles, whitepapers, case studies, product manuals, downloads, and job listings.
Using the Custom Facet Widget
In previous discussions, you learned how categories and fields can store metadata. While Liferay provides the Category Facet widget to filter by Categories, there is no built-in "Field Facet widget" for custom fields. This is where the Custom Facet widget becomes invaluable. It enables you to configure filters on almost any field in the Elasticsearch index. All you need to do is identify the name of the field in the index and then configure the widget to use this value.
You can add any number of Custom Facet widgets to a page. Also these widgets can be visible and configurable by end users, or you can hide them to pre-filter pages with set values (e.g., limiting results to specific types of web content, field values, or a combination).
Using Search Blueprints
Search Blueprints elevate pre-filtering by offering a low-code approach to construct the initial query for search pages. Blueprints can filter by asset type (similar to the Custom Facet widget) but also enable more sophisticated actions like boosting certain assets, pre-sorting results, and creating personalized search experiences. See official Search Blueprints documentation for more information, or explore the Mastering Liferay Content Search course.
Clarity’s Search Requirements
One of Clarity’s critical success factors is to ensure that content has high-discoverability and findability, both by external search engines and site users. Liferay’s built-in SEO features and robust search capabilities (powered by Elasticsearch) directly address these needs. For SEO, Liferay’s features can ensure proper indexing of product information and other key content for external discoverability, driving organic traffic. For site search, Clarity can both configure the default site search and create tailored content-specific pages for their products catalog, job listings, and articles.
Liferay’s flexible faceting capabilities, including category and custom facets, can enable Clarity’s users to filter search results by relevant metadata like product category and specific attributes. As Clarity’s content expands with their global growth, Liferay’s search infrastructure can help ensure their solution provides efficient access to product specifications, support documentation, and distributor resources.
Conclusion
Liferay provides sophisticated and flexible tools for building tailored search experiences. Whether customizing general site search, or building custom content-specific search pages, Liferay empowers organizations to ensure users can efficiently locate the content they need.
Next, you’ll explore strategies for managing user access to content.
Capabilities
Product
Education
Knowledge Base
Contact Us