(the correct list here is solr-user, not dev) Solr has minimal support for _formatting_ the response; that's generally up the the application that builds the UI. If you want Solr to retain the original input precision which appears to be lost here, then use a typical copyField approach to a string stored field. This is necessary because primitive field types (date, float, int, etc.) normalize the input when the value is internally stored. Perhaps it shouldn't do that -- as you show here the surface form (original) may indicate the precision.
~ David Smiley Apache Lucene/Solr Search Developer http://www.linkedin.com/in/davidwsmiley On Wed, May 8, 2019 at 10:42 PM Karthik Gunasekaran < karthik.gunaseka...@stats.govt.nz> wrote: > Hi, > > I am new to solr. I am using solr7.6 version. > > > > The problem which I am facing is to format the date for a specific field. > > > > Explanation of my issue: > > > > I have a collection named “DateFieldTest” > > It has few fields out of “initial_release_date” is a field of type pdate. > > We are loading the data into the collection as below > > > > > > [ > > { > > "id": 0, > > "Number": 0, > > "String": "This is a string 0", > > "initial_release_date": "2019-02-28" > > }, > > { > > "ID": 1, > > "Number": 1, > > "String": "This is a string 1", > > " initial_release_date ": "2019-02-28" > > }] > > > > When we do a select query as > http://localhost:8983/solr/DateFieldTest/select?q=*:* > > We are getting the output as, > > { > > "responseHeader":{ > > "zkConnected":true, > > "status":0, > > "QTime":0, > > "params":{ > > "q":"*:*"}}, > > "response":{"numFound":1000,"start":0,"docs":[ > > { > > "id":"0", > > "Number":[0], > > "String":["This is a Māori macron 0"], > > "initial_release_date":["2019-02-28T00:00:00Z"], > > "_version_":1633015101576445952}, > > { > > "ID":[1], > > "Number":[1], > > "String":["This is a Māori macron 1"], > > "initial_release_date":["2019-02-28T00:00:00Z"], > > "_version_":1633015101949739008}, > > > > But our use case is to get the output for the above query is to get the > initial_release_date field to be formatted as YYYY-MM-DD. > > The query returns by adding time to the data field automatically, which we > don’t want to happen. > > Can someone please help me to resolve this issue to get only date value > without time in my select query. > > > > Thanks, > > Karthik Gunasekaran > > Senior Applications Developer | kaiwhakawhanake Pūmanawa Tautono > > Digital Business - Channels | Ngā Ratonga Mamati - Ngā Hongere > > Digital Business Services | Ngā Ratonga Pakihi Mamati > > Stats NZ Tatauranga Aotearoa > * DDI* +64 4 931 4347 | stats.govt.nz <http://www.stats.govt.nz/> > > [image: cid:image007.jpg@01D29D69.DD3FD280] > > [image: cid:image008.png@01D29D69.DD3FD280] > <https://www.facebook.com/StatisticsNZ> [image: > cid:image009.png@01D29D69.DD3FD280] <https://twitter.com/Stats_NZ> [image: > cid:image010.png@01D29D69.DD3FD280] > <https://www.linkedin.com/company/statistics-new-zealand> > > >