Query regarding truncated Date Sort

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Query regarding truncated Date Sort

Inderjeet Singh
Hi

I am currently using solr 7.1.0.  I have indexed a few documents which have
a date associated with it.
The Managed schema configuration for that field is :
         <fieldType name="pdate" class="solr.DatePointField"
docValues="true"/>
         <field name="Published_Date" type="pdate" multiValued="false"
indexed="true" stored="true"/>

Example of few values are :
          "Published_Date":"2019-10-25T00:00:00Z"
"Published_Date":"2019-10-21T10:00:00Z"

I want to sort the documents based on these Published_Date parameters but
only on the day(not the time/timezones)
Sorting on the basis of '2019-10-25'

Please help me in finding how I could achieve this.

Regards
Inderjeet Singh
Reply | Threaded
Open this post in threaded view
|

Re: Query regarding truncated Date Sort

Paras Lehana
Hi Inderjeet,

Wouldn't sorting on the default format will yield documents date-wise
sorted? The time won't impact the date order or do you have
different timezones also?

On Thu, 7 Nov 2019 at 12:52, Inderjeet Singh <[hidden email]> wrote:

> Hi
>
> I am currently using solr 7.1.0.  I have indexed a few documents which have
> a date associated with it.
> The Managed schema configuration for that field is :
>          <fieldType name="pdate" class="solr.DatePointField"
> docValues="true"/>
>          <field name="Published_Date" type="pdate" multiValued="false"
> indexed="true" stored="true"/>
>
> Example of few values are :
>           "Published_Date":"2019-10-25T00:00:00Z"
> "Published_Date":"2019-10-21T10:00:00Z"
>
> I want to sort the documents based on these Published_Date parameters but
> only on the day(not the time/timezones)
> Sorting on the basis of '2019-10-25'
>
> Please help me in finding how I could achieve this.
>
> Regards
> Inderjeet Singh
>


--
--
Regards,

*Paras Lehana* [65871]
Development Engineer, Auto-Suggest,
IndiaMART Intermesh Ltd.

8th Floor, Tower A, Advant-Navis Business Park, Sector 142,
Noida, UP, IN - 201303

Mob.: +91-9560911996
Work: 01203916600 | Extn:  *8173*

--
IMPORTANT: 
NEVER share your IndiaMART OTP/ Password with anyone.
Reply | Threaded
Open this post in threaded view
|

Re: Query regarding truncated Date Sort

Erick Erickson
The easiest and most efficient would be to store the date (or a copy) at day resolution and sort on that field instead.

> On Nov 7, 2019, at 3:00 AM, Paras Lehana <[hidden email]> wrote:
>
> Hi Inderjeet,
>
> Wouldn't sorting on the default format will yield documents date-wise
> sorted? The time won't impact the date order or do you have
> different timezones also?
>
> On Thu, 7 Nov 2019 at 12:52, Inderjeet Singh <[hidden email]> wrote:
>
>> Hi
>>
>> I am currently using solr 7.1.0.  I have indexed a few documents which have
>> a date associated with it.
>> The Managed schema configuration for that field is :
>>         <fieldType name="pdate" class="solr.DatePointField"
>> docValues="true"/>
>>         <field name="Published_Date" type="pdate" multiValued="false"
>> indexed="true" stored="true"/>
>>
>> Example of few values are :
>>          "Published_Date":"2019-10-25T00:00:00Z"
>> "Published_Date":"2019-10-21T10:00:00Z"
>>
>> I want to sort the documents based on these Published_Date parameters but
>> only on the day(not the time/timezones)
>> Sorting on the basis of '2019-10-25'
>>
>> Please help me in finding how I could achieve this.
>>
>> Regards
>> Inderjeet Singh
>>
>
>
> --
> --
> Regards,
>
> *Paras Lehana* [65871]
> Development Engineer, Auto-Suggest,
> IndiaMART Intermesh Ltd.
>
> 8th Floor, Tower A, Advant-Navis Business Park, Sector 142,
> Noida, UP, IN - 201303
>
> Mob.: +91-9560911996
> Work: 01203916600 | Extn:  *8173*
>
> --
> IMPORTANT:
> NEVER share your IndiaMART OTP/ Password with anyone.