Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-10170

Search service's DateConstraint#toString depends on the JVM format locale to work correctly

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Outdated
    • 3.0.0
    • None
    • addon-search-service
    • None

    Description

      The DateConstraint object uses DateFormat.getDateInstance() to construct the query clause by which to search, resulting in e.g. "(date publicationDate >= Sep 28, 2012, resolution = DAY)"

      So it takes the default formatting locale from the local JVM which makes it depend on that locale being English.

      This was encountered on my machine that had failing tests, caused by my JVM's formatting locale being Dutch: org.onehippo.cms7.services.search.query.QueryTest#testStringVisitor resulted in

      org.junit.ComparisonFailure: 
      Expected : of type hippo:document select author where (text title contains ard) and (text [any] contains haha) and ((int count <= 5) or (date publicationDate >= Sep 28, 2012, resolution = DAY))
      Actual   : of type hippo:document select author where (text title contains ard) and (text [any] contains haha) and ((int count <= 5) or (date publicationDate >= 28-sep-2012, resolution = DAY))
      

      Note "Sep 28, 2012" versus "28-sep-2012"

      Note it turns out that this code, which is in the toString method, is not executed functionally (i.e. in advanced search) so does not break anything.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jhoffman Jeroen Hoffman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: