Troubleshoot Advanced Search - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.

25-05-2016

Troubleshoot Advanced Search

Incorrect results when searching for documents limited by publication date

Your search results show incorrect data in the 'Published' column if you select a date value in the 'Publication Date; To' filter.

This behaviour has been observed in implementations that were upgraded from Hippo CMS 7.8 to Hippo CMS 10.

The issue is caused by a change in the document model used to store content in the repository. In Hippo CMS 10 the hippostdpubwf:publicationDate property is never stored on draft and unpublished document variants. Document created and published before the upgrade to Hippo CMS 10 may have a hippostdpubwf:publicationDate stored on their draft or unpublished variant which is not updated anymore after the upgrade to Hippo CMS 10 and as a result becomes outdated. This outdated publication date may be displayed in the search results.

The issue can be fixed by removing all hippostdpubwf:publicationDate properties from draft and unpublished document variants using below Updater Script.

Query:

/jcr:root/content/documents//*[(@hippostd:state='draft' or @hippostd:state='unpublished') and @hippostdpubwf:publicationDate]

Groovy script:

package org.onehippo.cms.updater

import org.onehippo.cms.updater.BaseNodeUpdater

import javax.jcr.Node
import javax.jcr.PropertyType
import javax.jcr.PathNotFoundException
import javax.jcr.RepositoryException

/**
 * Adds default logo type property to cover documents that does not have one.
 */
class RemovePublicationDatePropertyFromUnpublishedAndDraft extends BaseNodeUpdater {

  public static final String PUBLICATION_DATE = "hippostdpubwf:publicationDate"

  boolean doUpdate(Node node) {
    log.debug("Updating {}", node.getPath())
    try {
      if (node.hasProperty(PUBLICATION_DATE)) {
        node.getProperty(PUBLICATION_DATE).remove()
        return true
      }
    } catch (RepositoryException e) {
      log.debug("An error occurred {}", e.getMessage())
      return false
    }
  }
}
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?