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

MB-58388: Use custom datetime parsers in date range facet queries #1878

Merged
merged 5 commits into from Sep 7, 2023

Conversation

CascadingRadium
Copy link
Contributor

@CascadingRadium CascadingRadium commented Sep 6, 2023

Jira

MB-58388

Description

Related to Date range facet queries:

  • The "start" and "end" fields of the Facet Result struct are now formatted with the layout that successfully parsed them in the Facet Request struct. Earlier we always used RFC3339Nano by default which led to disparity between the corresponding fields in the facet request and result.
    Ex - Facet Request Date Range:

        { 
            start : "2014-09-10"
            end : "2015-08-11"
        }
    

Previously the Facet result had

      { 
          start : "2014-09-10T00:00:00Z"
          end : "2015-08-11T00:00:00Z"
          Count: 100
      }

Now it has

      { 
          start : "2014-09-10"
          end : "2015-08-11"
          Count: 100
      }
  • Allow a custom date time parser to be added to the date range struct of a facet request, that will override the default date time parser (dateTimeOptional) while parsing the start and end date strings.
  • Add error message when the date time parser fails to parse the date string. Earlier if the date time parser failed to parse the start and end strings of the date range in the facet request, no error was thrown and the facet request would be for start and end being equal to 0 time, so facet result was always nil.
  • Fix marshalling error for dateRangeQuery struct. If the query had no end / endString, which is the case when upper bound is unspecified, the marshalled JSON always had the 0 time (time.Time{}) as the value for end, now it is omitted from the marshalled JSON.

@CascadingRadium CascadingRadium self-assigned this Sep 6, 2023
@CascadingRadium CascadingRadium added this to the v2.3.10 milestone Sep 6, 2023
@CascadingRadium CascadingRadium changed the title Mb 58388 MB-58388: Use custom datetime parsers in date range facet queries. Sep 6, 2023
@CascadingRadium CascadingRadium changed the title MB-58388: Use custom datetime parsers in date range facet queries. MB-58388: Use custom datetime parsers in date range facet queries Sep 6, 2023
index_impl.go Show resolved Hide resolved
index_impl.go Show resolved Hide resolved
search.go Show resolved Hide resolved
search.go Show resolved Hide resolved
@CascadingRadium CascadingRadium merged commit 81c11e1 into master Sep 7, 2023
9 checks passed
@CascadingRadium CascadingRadium deleted the MB-58388 branch September 7, 2023 19:38
CascadingRadium added a commit that referenced this pull request Sep 13, 2023
)

Related to Date range facet queries:

- The "start" and "end" fields of the Facet Result struct are now
formatted with the layout that successfully parsed them in the Facet
Request struct. Earlier we always used RFC3339Nano by default which led
to disparity between the corresponding fields in the facet request and
result.
   Ex - Facet Request Date Range:

          { 
              start : "2014-09-10"
              end : "2015-08-11"
          }

Previously the Facet result had 

          { 
              start : "2014-09-10T00:00:00Z"
              end : "2015-08-11T00:00:00Z"
              Count: 100
          }

Now it has 

          { 
              start : "2014-09-10"
              end : "2015-08-11"
              Count: 100
          }
- Allow a custom date time parser to be added to the date range struct
of a facet request, that will override the default date time parser
(dateTimeOptional) while parsing the start and end date strings.
- Add error message when the date time parser fails to parse the date
string. Earlier if the date time parser failed to parse the start and
end strings of the date range in the facet request, no error was thrown
and the facet request would be for start and end being equal to 0 time,
so facet result was always nil.
- Fix marshalling error for dateRangeQuery struct. If the query had no
end / endString, which is the case when upper bound is unspecified, the
marshalled JSON always had the 0 time (time.Time{}) as the value for
end, now it is omitted from the marshalled JSON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants