Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date range searches give incorrect results #466

Open
nielsklazenga opened this issue Jul 1, 2021 · 3 comments
Open

Date range searches give incorrect results #466

nielsklazenga opened this issue Jul 1, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@nielsklazenga
Copy link

nielsklazenga commented Jul 1, 2021

The ticket in the Support queue is about a search in AVH on eventDate, but I think it might be a general issue with searching on date fields.

We are trying to find records of specimens collected by N.N. Donner on 23 April 1974.

https://avh.ala.org.au/occurrences/search?q=collector_text%3ADonner+AND+occurrence_date%3A%5B1974-04-23T00%3A00%3A00Z+TO+1974-04-24T00%3A00%3A00Z%5D gives no results, while there should be 24.

After a bit of trial and error, I found that https://avh.ala.org.au/occurrences/search?q=collector_text%3ADonner+AND+occurrence_date%3A%5B1974-04-22T14%3A00%3A00Z+TO+1974-04-23T14%3A00%3A00Z%5D gives the expected results.

It turns out that eventDate is stored in SOLR as timestamps for midnight AEST, which is 2 pm the previous day in UTC:

https://biocache-ws.ala.org.au/ws/occurrences/search?q=*%3A*&fq=data_hub_uid%3Adh9&fq=collector_text%3ADonner&fq=eventDate%3A%5B1974-04-22T00%3A00%3A00Z%20TO%201974-04-24T00%3A00%3A00Z%5D&facets=eventDate

  "facetResults": [
    {
      "fieldName": "eventDate",
      "fieldResult": [
        {
          "label": "1974-04-22T14:00:00Z",
          "i18nCode": "eventDate.1974-04-22T14:00:00Z",
          "count": 24,
          "fq": "eventDate:\"1974-04-22T14:00:00Z\""
        }
      ]
    }
  ]

Storing dates without times as UTC timestamps would solve the problem.

@javier-molina javier-molina added the bug Something isn't working label Jul 1, 2021
@djtfmartin
Copy link
Member

djtfmartin commented Jul 1, 2021

This is something to fix in the IndexRecordTransform in pipelines, and I agree with @nielsklazenga suggested remedy.

@adam-collins adam-collins self-assigned this Jul 27, 2021
@javier-molina
Copy link

@adam-collins do you have a pointer to the PR for this change?

@timhicks-ala
Copy link

Helpdesk ticket: https://support.ehelp.edu.au/a/tickets/110988

@javier-molina , @adam-collins - just following up, was there a fix for this one in the end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants