AEM Assets: Search result ordering and performance with indexTag
This article explains why search results in Adobe Experience Manager (AEM) Assets appear out of order or load slowly when using the indexTag parameter in QueryBuilder, and provides steps to ensure correct ordering and optimal performance.
Description description
When running asset searches in AEM using QueryBuilder, adding the indexTag parameter can affect both the order and speed of search results. This is because indexTag forces the query to use a specific index, which may not be configured to support ordered sorting on the requested field. Without indexTag, AEM selects the most optimal index, often resulting in correct ordering and faster responses.
Environment
Adobe Experience Manager (AEM) Assets (all versions)
Symptoms
- Search results aren’t ordered by the newest items first, even when using
orderbyandorderby.sortparameters. - Search response times are slower when
indexTagis used. - Without
indexTag, results are correctly ordered and load faster.
Example Query Parameter Explanations
path: The repository path to search under (For example:/content/dam/projects)type: Node type to search for (For example:dam:Asset)p.offsetandp.limit: Pagination controls for result setp.hits: Controls the detail level of returned resultsp.nodedepth: Depth of nodes to include in resultsgroup.tagid.propertyand related group parameters: Filter results by specific metadata properties and values.orderby: Field to sort results by (For example:publishDatetime)orderby.sort: Sort direction (asc or desc)p.indexTag: Forces the query to use a specific index with the given tag.
Resolution resolution
Follow the steps below to resolve the issue:
-
Identify the field you want to sort by in your query (For example:
publishDatetime). -
Review the index definition associated with the
indexTagyou’re using:-
In AEM, navigate to the index definitions (typically under
/oak:indexin CRXDE Lite). -
Locate the index with the specified tag.
-
-
Check if the index definition includes the property you want to sort by, with
ordered=true(For example:ordered=trueforpublishDatetime). -
If the property is missing or not set as ordered, update the index definition:
-
Add the property to the index definition with
ordered=true. -
Save and reindex, if required.
-
-
Alternatively, use an
indexTagthat already supports ordered sorting on your required field (For example: for general asset searches). -
After making changes, rerun your query, and verify that results are ordered correctly and performance is improved.