You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ali Nazemian <al...@gmail.com> on 2015/06/09 17:47:00 UTC

Date Format Conversion Function Query

Dear all,
Hi,
I was wondering is there any function query for converting date format in
Solr? If no, how can I implement such function query myself?

-- 
A.Nazemian

Re: Date Format Conversion Function Query

Posted by Ali Nazemian <al...@gmail.com>.
Thank you very much.
It seems that document transformer is the perfect extension point for this
conversion. I will try to implement that.
Best regards.

On Wed, Jun 10, 2015 at 3:54 PM, Upayavira <uv...@odoko.co.uk> wrote:

> Another technology that might make more sense is a Doc Transformer.
>
> You also specify them in the fl parameter. I would imagine you could
> specify
>
> fl=id,[persian f=gregorian_Date]
>
> See here for more cases:
>
>
> https://cwiki.apache.org/confluence/display/solr/Transforming+Result+Documents
>
> This does not exist right now, but would make a good contribution to
> Solr itself, I'd say.
>
> Upayavira
>
> On Wed, Jun 10, 2015, at 09:57 AM, Alessandro Benedetti wrote:
> > Erick will correct me if I am wrong but this function query I don't think
> > it exists.
> > But maybe can be a nice contribution.
> > It should take in input a date format and a field and give in response
> > the
> > new formatted Date.
> >
> > The would be simple to use it :
> >
> > fl=id,persian_date:dateFormat("yyyy/mm/dd",gregorian_Date)
> >
> > The date format is an example in input is an example.
> >
> > Cheers
> >
> > 2015-06-10 7:24 GMT+01:00 Ali Nazemian <al...@gmail.com>:
> >
> > > Dear Erick,
> > > Hi,
> > > Actually I want to convert date format from Geregorian calendar (solr
> > > default) to Perisan calendar. You may ask why i do not do that at
> client
> > > side? Here is why:
> > >
> > > I want to provide a way to extract data from solr in the csv format. I
> know
> > > that solr has csv ResponseWriter that could be used in this case. But
> my
> > > problem is that the date format in solr index is provided by Geregorian
> > > calendar and I want to put that in Persian calendar. Therefore I was
> > > thinking of a function query to do that at query time for me.
> > >
> > > Regards.
> > >
> > > On Tue, Jun 9, 2015 at 10:55 PM, Erick Erickson <
> erickerickson@gmail.com>
> > > wrote:
> > >
> > > > I'm not sure what you're asking for, give us an example input/output
> > > pair?
> > > >
> > > > Best,
> > > > Erick
> > > >
> > > > On Tue, Jun 9, 2015 at 8:47 AM, Ali Nazemian <al...@gmail.com>
> > > > wrote:
> > > > > Dear all,
> > > > > Hi,
> > > > > I was wondering is there any function query for converting date
> format
> > > in
> > > > > Solr? If no, how can I implement such function query myself?
> > > > >
> > > > > --
> > > > > A.Nazemian
> > > >
> > >
> > >
> > >
> > > --
> > > A.Nazemian
> > >
> >
> >
> >
> > --
> > --------------------------
> >
> > Benedetti Alessandro
> > Visiting card : http://about.me/alessandro_benedetti
> >
> > "Tyger, tyger burning bright
> > In the forests of the night,
> > What immortal hand or eye
> > Could frame thy fearful symmetry?"
> >
> > William Blake - Songs of Experience -1794 England
>



-- 
A.Nazemian

Re: Date Format Conversion Function Query

Posted by Upayavira <uv...@odoko.co.uk>.
Another technology that might make more sense is a Doc Transformer.

You also specify them in the fl parameter. I would imagine you could
specify

fl=id,[persian f=gregorian_Date]

See here for more cases:

https://cwiki.apache.org/confluence/display/solr/Transforming+Result+Documents

This does not exist right now, but would make a good contribution to
Solr itself, I'd say.

Upayavira

On Wed, Jun 10, 2015, at 09:57 AM, Alessandro Benedetti wrote:
> Erick will correct me if I am wrong but this function query I don't think
> it exists.
> But maybe can be a nice contribution.
> It should take in input a date format and a field and give in response
> the
> new formatted Date.
> 
> The would be simple to use it :
> 
> fl=id,persian_date:dateFormat("yyyy/mm/dd",gregorian_Date)
> 
> The date format is an example in input is an example.
> 
> Cheers
> 
> 2015-06-10 7:24 GMT+01:00 Ali Nazemian <al...@gmail.com>:
> 
> > Dear Erick,
> > Hi,
> > Actually I want to convert date format from Geregorian calendar (solr
> > default) to Perisan calendar. You may ask why i do not do that at client
> > side? Here is why:
> >
> > I want to provide a way to extract data from solr in the csv format. I know
> > that solr has csv ResponseWriter that could be used in this case. But my
> > problem is that the date format in solr index is provided by Geregorian
> > calendar and I want to put that in Persian calendar. Therefore I was
> > thinking of a function query to do that at query time for me.
> >
> > Regards.
> >
> > On Tue, Jun 9, 2015 at 10:55 PM, Erick Erickson <er...@gmail.com>
> > wrote:
> >
> > > I'm not sure what you're asking for, give us an example input/output
> > pair?
> > >
> > > Best,
> > > Erick
> > >
> > > On Tue, Jun 9, 2015 at 8:47 AM, Ali Nazemian <al...@gmail.com>
> > > wrote:
> > > > Dear all,
> > > > Hi,
> > > > I was wondering is there any function query for converting date format
> > in
> > > > Solr? If no, how can I implement such function query myself?
> > > >
> > > > --
> > > > A.Nazemian
> > >
> >
> >
> >
> > --
> > A.Nazemian
> >
> 
> 
> 
> -- 
> --------------------------
> 
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
> 
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
> 
> William Blake - Songs of Experience -1794 England

Re: Date Format Conversion Function Query

Posted by Alessandro Benedetti <be...@gmail.com>.
Erick will correct me if I am wrong but this function query I don't think
it exists.
But maybe can be a nice contribution.
It should take in input a date format and a field and give in response the
new formatted Date.

The would be simple to use it :

fl=id,persian_date:dateFormat("yyyy/mm/dd",gregorian_Date)

The date format is an example in input is an example.

Cheers

2015-06-10 7:24 GMT+01:00 Ali Nazemian <al...@gmail.com>:

> Dear Erick,
> Hi,
> Actually I want to convert date format from Geregorian calendar (solr
> default) to Perisan calendar. You may ask why i do not do that at client
> side? Here is why:
>
> I want to provide a way to extract data from solr in the csv format. I know
> that solr has csv ResponseWriter that could be used in this case. But my
> problem is that the date format in solr index is provided by Geregorian
> calendar and I want to put that in Persian calendar. Therefore I was
> thinking of a function query to do that at query time for me.
>
> Regards.
>
> On Tue, Jun 9, 2015 at 10:55 PM, Erick Erickson <er...@gmail.com>
> wrote:
>
> > I'm not sure what you're asking for, give us an example input/output
> pair?
> >
> > Best,
> > Erick
> >
> > On Tue, Jun 9, 2015 at 8:47 AM, Ali Nazemian <al...@gmail.com>
> > wrote:
> > > Dear all,
> > > Hi,
> > > I was wondering is there any function query for converting date format
> in
> > > Solr? If no, how can I implement such function query myself?
> > >
> > > --
> > > A.Nazemian
> >
>
>
>
> --
> A.Nazemian
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Date Format Conversion Function Query

Posted by Ali Nazemian <al...@gmail.com>.
Dear Erick,
Hi,
Actually I want to convert date format from Geregorian calendar (solr
default) to Perisan calendar. You may ask why i do not do that at client
side? Here is why:

I want to provide a way to extract data from solr in the csv format. I know
that solr has csv ResponseWriter that could be used in this case. But my
problem is that the date format in solr index is provided by Geregorian
calendar and I want to put that in Persian calendar. Therefore I was
thinking of a function query to do that at query time for me.

Regards.

On Tue, Jun 9, 2015 at 10:55 PM, Erick Erickson <er...@gmail.com>
wrote:

> I'm not sure what you're asking for, give us an example input/output pair?
>
> Best,
> Erick
>
> On Tue, Jun 9, 2015 at 8:47 AM, Ali Nazemian <al...@gmail.com>
> wrote:
> > Dear all,
> > Hi,
> > I was wondering is there any function query for converting date format in
> > Solr? If no, how can I implement such function query myself?
> >
> > --
> > A.Nazemian
>



-- 
A.Nazemian

Re: Date Format Conversion Function Query

Posted by Erick Erickson <er...@gmail.com>.
I'm not sure what you're asking for, give us an example input/output pair?

Best,
Erick

On Tue, Jun 9, 2015 at 8:47 AM, Ali Nazemian <al...@gmail.com> wrote:
> Dear all,
> Hi,
> I was wondering is there any function query for converting date format in
> Solr? If no, how can I implement such function query myself?
>
> --
> A.Nazemian