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 Ahmed Adel <ah...@badrit.com> on 2015/01/26 06:35:54 UTC

Indexed epoch time in Solr

Hi All,

Is there a way to convert unix time field that is already indexed to
ISO-8601 format in query response? If this is not possible on the query
level, what is the best way to copy this field to a new Solr standard date
field.

Thanks,

-- 
*Ahmed Adel*
<http://s.wisestamp.com/links?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2F>

Re: Indexed epoch time in Solr

Posted by Dan Davis <da...@gmail.com>.
I think copying to a new Solr date field is your best bet, because then you
have the flexibility to do date range facets in the future.

If you can re-index, and are using Data Import Handler, Jim Musil's
suggestion is just right.

If you can re-index, and are not using Data Import Handler:

   - This seems a job for an UpdateRequestProcessor
   <https://cwiki.apache.org/confluence/display/solr/Update+Request+Processors>,
   but I don't see one for this.
   - This seems to be a good candidate for a standard, core
   UpdateRequestProcessor, but I haven't checked Jira for a bug report.

If the scale is too large to re-index, then there is surely still a way,
but I'm not sure I can advise you on the best one.  I'm not an Solr expert
yet... just someone on the list with a IR background.

On Mon, Jan 26, 2015 at 12:35 AM, Ahmed Adel <ah...@badrit.com> wrote:

> Hi All,
>
> Is there a way to convert unix time field that is already indexed to
> ISO-8601 format in query response? If this is not possible on the query
> level, what is the best way to copy this field to a new Solr standard date
> field.
>
> Thanks,
>
> --
> *Ahmed Adel*
> <http://s.wisestamp.com/links?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2F>
>

Re: Indexed epoch time in Solr

Posted by "Jim.Musil" <Ji...@target.com>.
If you are using the DataImportHandler, you can leverage on of the
transformers, such as the DateFormatTransformer:

http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer


If you are updating documents directly you can define a regex
transformation in your schema.xml:

https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PatternRe
placeCharFilterFactory


If you have control over the input, then I always find it better to just
transform it prior to sending it into solr.

Jim

On 1/25/15, 11:35 PM, "Ahmed Adel" <ah...@badrit.com> wrote:

>Hi All,
>
>Is there a way to convert unix time field that is already indexed to
>ISO-8601 format in query response? If this is not possible on the query
>level, what is the best way to copy this field to a new Solr standard date
>field.
>
>Thanks,
>
>-- 
>*Ahmed Adel*
><http://s.wisestamp.com/links?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2F>


Re: Indexed epoch time in Solr

Posted by Jorge Luis Betancourt González <jl...@uci.cu>.
Perhaps could you use a DocTransformer to convert the unix time field into any representation you want? You'll need to write a custom DocTransformer but this is no complex task.

Regards,

----- Original Message -----
From: "Ahmed Adel" <ah...@badrit.com>
To: solr-user@lucene.apache.org
Sent: Monday, January 26, 2015 12:35:54 AM
Subject: Indexed epoch time in Solr

Hi All,

Is there a way to convert unix time field that is already indexed to
ISO-8601 format in query response? If this is not possible on the query
level, what is the best way to copy this field to a new Solr standard date
field.

Thanks,

-- 
*Ahmed Adel*
<http://s.wisestamp.com/links?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2F>


---------------------------------------------------
XII Aniversario de la creación de la Universidad de las Ciencias Informáticas. 12 años de historia junto a Fidel. 12 de diciembre de 2014.