Liferay DXP Searching & Indexing FAQ

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.

Affected Products

Liferay DXP 7.0, DXP 7.1, DXP 7.2

Contents

  1. What is indexing and how does it help my platform?
  2. What sort of entities are indexed in Liferay DXP?
  3. When is the index created?
  4. When is the index updated?
  5. Can I "force" a reindex in Liferay?
  6. How do I write code in a way that allows my entities to be indexed?

Resolution

What is indexing and how does it help my platform?

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.

What sort of entities are indexed in Liferay DXP?

Here are the DXP entities that utilize search index out of the box:

  • Bookmark entries
  • Bookmark folders
  • Blog entries
  • Calendar & Calendar Events
  • Categories
  • 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
  • Organizations
  • Polls
  • Segments entries
  • System Settings
  • Tags
  • Users
  • User Groups
  • Web Content articles
  • Web Content folders
  • Wiki pages
  • Workflow metrics

To index custom entities, read:

When is the index created?

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).

When is the index updated?

By default, the search index is updated every time an indexable entity is:

  • Created
  • Modified
  • Deleted

Can I “force” a reindex in Liferay?

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.

To reindex:

  1. Log in as an administrative user
  2. Click on Control Panel → Configuration → Search
  3. 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.

How do I write code in a way that allows my entities to be indexed?

We have documented exactly how a developer would do that in this article: Indexing Framework

Was this article helpful?
0 out of 0 found this helpful