This article aims to answer basic questions around how indexing works in Liferay DXP. This information is applicable for all search platforms whether using Elasticsearch, Solr, or some other search. For a full developer’s treatment of developing for the index, please see: Introduction to Search.
- Liferay DXP 7.0 - DXP 7.4
- What is indexing and how does it help my platform?
- What sort of entities are indexed in Liferay DXP?
- When is the index created?
- When is the index updated?
- Can I "force" a reindex in Liferay?
- How do I write code in a way that allows my entities to be indexed?
Liferay stores its information in a database, so why not search the database directly? Why add the complexity of a search engine? First, because database table merges are expensive! Documents in a search index often contain searchable fields from multiple tables in the database. Traversing the date in this way takes too long.
In addition to the performance problem, search engines provide access to additional features, like relevance and scoring. By contrast, databases do not support features like fuzzy searching or relevancy. Moreover, search engines can apply algorithms such as “More Like This” to return similar content. Search engines also support geolocation, faceting of search results, and multilingual searching.
Here are the DXP entities that utilize search index out of the box:
- Bookmark entries
- Bookmark folders
- Blog entries
- Calendar & Calendar Events
- Change List entries
- Custom Fields (Expando)
- Documents and Media files
- Documents and Media folders
- Dynamic Data List records
- Dynamic Data Mapping fields (for example for Web Content Structures, Forms)
- Message Board Messages and Threads
- Segments entries
- System Settings
- User Groups
- Web Content articles
- Web Content folders
- Wiki pages
- Workflow metrics
To index custom entities, read:
The initial search index is initialized for each virtual instance the first time you start DXP with Elasticsearch or Solr. To fully index all entries you need to perform a “Reindex” from the Control Panel (see below).
By default, the search index is updated every time an indexable entity is:
There’s a number of reasons you may need to create a new index from scratch. Whether it’s following an upgrade or it’s just that the search isn’t pulling up the correct results, we’ve made it simple to delete the existing index and create a new one.
- Log in as an administrative user
- Click on Control Panel → Configuration → Search (in DXP 7.3 and 7.4, it is under Control Panel → Search, and the Index Actions tab)
- Click the Execute button for Reindex all search indexes and then Reindex all spell check indexes.
Please note that, depending on how many entities there are, the reindexing may be a time and memory-intensive operation. Please plan the timing of your reindex accordingly.
We have documented exactly how a developer would do that in this article: Indexing Framework