Gus,
Perhaps you might try the technique described in the forwarded exchange
below. It has been working very nicely for me.
Terry
-------- Forwarded Message --------
Subject: Re: Changing Field Assignments
Date: Tue, 12 Jun 2018 12:21:16 +0900
From: Yasufumi Mizoguchi <[email protected]>
Reply-To: [email protected]
To: [email protected]
Hi,
You can do that via adding the following lines in managed-schema.
<dynamicField name="*_range" type="date_range" indexed="true"
stored="true"/>
<fieldType name="date_range" class="solr.DateRangeField"/>
<copyField source="*_date" dest="*_date_range"/>
After adding the above and re-indexing docs, you will get the result like
following.
{ "responseHeader":{ "status":0, "QTime":0, "params":{ "q":"*:*", "indent":
"on", "wt":"json", "_":"1528772599296"}}, "response":{"numFound":2,"start":0
,"docs":[ { "id":"test2", "meta_creation_date":["2018-04-30T00:00:00Z"], "
meta_creation_date_range":"2018-04-30T00:00:00Z", "_version_":
1603034044781559808}, { "id":"test", "meta_creation_date":[
"1944-04-02T00:00:00Z"], "meta_creation_date_range":"1944-04-02T00:00:00Z",
"_version_":1603034283921899520}] }}
thanks,
Yasufumi
2018年6月12日(火) 5:04 Terry Steichen <[email protected]>:
> I am using Solr (6.6.0) in the automatic mode (where it discovers
> fields). It's working fine with one exception. The problem is that
> Solr maps the discovered "meta_creation_date" is assigned the type
> TrieDateField.
>
> Unfortunately, that type is limited in a number of ways (like sorting,
> abbreviated forms and etc.). What I'd like to do is have that
> ("meta_creation_date") field assigned to a different type, like
> DateRangeField.
>
> Is it possible to accomplish this (during indexing) by creating a copy
> field to a different type, and using the copy field in the query? Or
> via some kind of function operation (which I've never understood)?
>
>
On 07/12/2018 02:43 PM, Gus Heck wrote:
> XY question not withstanding, this is exactly the sort of thing one might
> want to do in their indexing pipeline. For example:
>
> https://github.com/nsoft/jesterj/blob/master/code/ingest/src/main/java/org/jesterj/ingest/processors/SimpleDateTimeReformatter.java
>
> On Thu, Jul 12, 2018 at 1:34 PM, Erick Erickson <[email protected]>
> wrote:
>
>> This seems like an XY problem, you've asked how to do X without
>> explaining _why_ (the Y).
>>
>> If this is just because you want to search the field without having
>> to specify the full string, consider a DateRangeField.
>>
>> Best,
>> Erick
>>
>> On Thu, Jul 12, 2018 at 10:22 AM, Anil <[email protected]> wrote:
>>> HI,
>>>
>>> i have a date field which needs to copied to different field with
>> different
>>> format/value. is there any way to achieve this using copy field ? or
>> needs
>>> to be done when creating solr document itself.
>>>
>>> lets say createdDate is 10-23-2017 10:15:00, it needs to be copied to
>>> transformedDate field as 10-23-2017.
>>>
>>> please help. thanks.
>>>
>>> Regards,
>>> Anil
>
>