Ticket #20282 (new Bug)

Opened 12 months ago

Comments may have effective date in the future hiding them from search results

Reported by: evilbungle Owned by: tisto
Priority: minor Milestone: 4.x
Component: Commenting/Discussion Version: 4.3
Keywords: Cc:

Description

Internally, comment objects store dates as naive datetime objects. This differs from most content objects which store timezone aware DateTime objects.

When a comment is indexed, custom indexers are used to convert the internal datetime objects to DateTime. These custom indexers force a timezone of GMT which may cause the indexed date to be in the future when compared to the current local time (for example, during BST). See  https://github.com/plone/plone.app.discussion/blob/master/plone/app/discussion/catalog.py.

By default when querying the catalog via searchResults the results exclude inactive objects (those for which the current date does not lie between the effective and expiry dates). This is achieved by passing the current local time to the effectiveRange index.

This can cause comments to fail to appear in search results when the effective date for a comment (normally equivalent to the creation date) is in the future.

I don't believe this affects anything publicly visible as comments aren't included in search results, however it does affect anything where custom code searches for comments. For us it means they appear an hour late (BST) but this may be significantly worse for those whose native timezone is already multiple hours ahead of GMT.

Marked as 4.3 only because that's what I have to hand - the issue persists in p.a.discussion master.

Note: See TracTickets for help on using tickets.