You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Susheel Kumar <su...@gmail.com> on 2023/06/06 13:28:47 UTC
min date function - Solr Streaming
Hello,
How can we take a minimum date in a grouping scenario. I tried using the
min function but it converts all dates to a fixed e Value.
rollup(
search(employee_position,
q="*:*",
qt="/export",
fl="EMPLOYEE_ID_s,POSITION_ID_s,HIRE_DATE_dt",
df="_text_",
sort="POSITION_ID_s asc, HIRE_DATE_dt asc"),
over="POSITION_ID_s",
count(HIRE_DATE_dt),
min(HIRE_DATE_dt))
==
"docs": [
{
"min(HIRE_DATE_dt)": 1.7976931348623157e+308,
"POSITION_ID_s": "017681N",
"count(HIRE_DATE_dt)": 1
},
{
"min(HIRE_DATE_dt)": 1.7976931348623157e+308,
"POSITION_ID_s": "017686N",
"count(HIRE_DATE_dt)": 2
},
Re: min date function - Solr Streaming
Posted by Susheel Kumar <su...@gmail.com>.
Thank you so much Joel.
On Tue, Jun 6, 2023 at 11:21 AM Joel Bernstein <jo...@gmail.com> wrote:
> Looks like this ticket never got documented:
>
> https://issues.apache.org/jira/browse/SOLR-10303
>
> In your case you'll want to use the epoch function which returns unix time:
>
> select(search(collection),
> epoch(date_dt) as utime)
>
> I'll create a jira to document this feature.
>
>
>
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Tue, Jun 6, 2023 at 9:29 AM Susheel Kumar <su...@gmail.com>
> wrote:
>
> > Hello,
> >
> > How can we take a minimum date in a grouping scenario. I tried using the
> > min function but it converts all dates to a fixed e Value.
> >
> > rollup(
> > search(employee_position,
> > q="*:*",
> > qt="/export",
> > fl="EMPLOYEE_ID_s,POSITION_ID_s,HIRE_DATE_dt",
> > df="_text_",
> > sort="POSITION_ID_s asc, HIRE_DATE_dt asc"),
> > over="POSITION_ID_s",
> > count(HIRE_DATE_dt),
> > min(HIRE_DATE_dt))
> >
> >
> > ==
> > "docs": [
> > {
> > "min(HIRE_DATE_dt)": 1.7976931348623157e+308,
> > "POSITION_ID_s": "017681N",
> > "count(HIRE_DATE_dt)": 1
> > },
> > {
> > "min(HIRE_DATE_dt)": 1.7976931348623157e+308,
> > "POSITION_ID_s": "017686N",
> > "count(HIRE_DATE_dt)": 2
> > },
> >
>
Re: min date function - Solr Streaming
Posted by Joel Bernstein <jo...@gmail.com>.
Looks like this ticket never got documented:
https://issues.apache.org/jira/browse/SOLR-10303
In your case you'll want to use the epoch function which returns unix time:
select(search(collection),
epoch(date_dt) as utime)
I'll create a jira to document this feature.
Joel Bernstein
http://joelsolr.blogspot.com/
On Tue, Jun 6, 2023 at 9:29 AM Susheel Kumar <su...@gmail.com> wrote:
> Hello,
>
> How can we take a minimum date in a grouping scenario. I tried using the
> min function but it converts all dates to a fixed e Value.
>
> rollup(
> search(employee_position,
> q="*:*",
> qt="/export",
> fl="EMPLOYEE_ID_s,POSITION_ID_s,HIRE_DATE_dt",
> df="_text_",
> sort="POSITION_ID_s asc, HIRE_DATE_dt asc"),
> over="POSITION_ID_s",
> count(HIRE_DATE_dt),
> min(HIRE_DATE_dt))
>
>
> ==
> "docs": [
> {
> "min(HIRE_DATE_dt)": 1.7976931348623157e+308,
> "POSITION_ID_s": "017681N",
> "count(HIRE_DATE_dt)": 1
> },
> {
> "min(HIRE_DATE_dt)": 1.7976931348623157e+308,
> "POSITION_ID_s": "017686N",
> "count(HIRE_DATE_dt)": 2
> },
>