Traversal warning for prism:expirationDate query

Issue

You see this warning repeating in your AEM log files: 

23.03.2017 07:49:59.379 *WARN* [pool-8-thread-3] org.apache.jackrabbit.oak.spi.query.Cursors$TraversingCursor Traversed 2993000 nodes with filter Filter(query=select [jcr:path], [jcr:score], * from [dam:Asset] as a where [jcr
:content/metadata/prism:expirationDate] > cast('2017-03-22T07:00:00.000Z' as date) and [jcr:content/metadata/prism:expirationDate] < cast('2017-03-23T07:00:00.001Z' as date) and isdescendantnode(a, '/content/dam') /* xpath: /
jcr:root/content/dam//element(*, dam:Asset)[(jcr:content/metadata/@prism:expirationDate > xs:dateTime('2017-03-22T07:00:00.000Z') and jcr:content/metadata/@prism:expirationDate < xs:dateTime('2017-03-23T07:00:00.001Z'))] */,
path=/content/dam//*, property=[jcr:content/metadata/prism:expirationDate=[(2017-03-22T07:00:00.000Z.., ..2017-03-23T07:00:00.001Z)]]); consider creating an index or changing the query

This warning message means that something is wrong in the AEM instance where the /oak:index/damAssetLucene index isn't working.   That causes the query above to do a traversal instead of using the damAssetLucene index.

Environment

Cause

Something is wrong with the /oak:index/damAssetLucene index.  You would need to investigate the log files and search for "damAssetLucene" to find out the exact root cause.

Resolution

A. Investigate the root cause

Search in the error.log and any other configured indexing logs for "damAssetLucene".  Investigate on any ERROR or WARN level messages to see if they are the cause of the issue.

For example, in one customer's case, this was the cause of issue: 

22.03.2017 12:46:45.205 *ERROR* [Thread-44] org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker Could not access the Lucene index at /oak:index/damAssetLucene
java.io.FileNotFoundException: [/oak:index/damAssetLucene] segments_8o28

B. Try rebuilding the local index copy

  1. Stop AEM

  2. Delete crx-quickstart/repository/index

  3. Start AEM

  4. Test again

C. Decide whether or not to reindex 

If rebuilding the local index copy didn't solve the issue then contact AEM Customer Care to further debug and decide if you need to reindex the /oak:index/damAssetLucene index.