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 "Kallu, Sreenivasa (HQP)" <sr...@roberthalf.com> on 2016/01/28 21:58:30 UTC

How to convert string field to date

Hi,
       I am new to solr.

I am using managed-schema. I am not using schema.xml.  I am indexing outlook email messages.
I can see only see three fields ( id,_version_,_text_) defined in managed-schema. Remaining fields are
handled by following dynamic field
<dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>

I have field name attr_date with type string. I want convert this field type to date. Currently date range is not
working on this field. I tried schema API to add new field attr_date and got following error message
"Field 'attr_date' already exists".  I tried to replace field type to date and got following error message
"The field 'attr_date' is not present in this schema, and so cannot be replaced".

Please help me to convert "attr_date"  field type to date.

Advanced Thanks.
--sreenivasa kallu



RE: How to convert string field to date

Posted by "Kallu, Sreenivasa (HQP)" <sr...@roberthalf.com>.
Thanks steve. Workaround 2 is working fine.

Thanks again.
--sreenivasa kallu

-----Original Message-----
From: Steve Rowe [mailto:sarowe@gmail.com] 
Sent: Thursday, January 28, 2016 6:03 PM
To: solr-user@lucene.apache.org
Subject: Re: How to convert string field to date

Try workaround 2, I did and it worked for me.  See my comment on the issue: <https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_SOLR-2D8607-3FfocusedCommentId-3D15122751-26page-3Dcom.atlassian.jira.plugin.system.issuetabpanels-3Acomment-2Dtabpanel-23comment-2D15122751&d=CwIFaQ&c=19TEyCb-E0do3cLmFgm9ItTXlbGQ5gmhRAlAtE256go&r=ZV-VnW_JFfcZo8vYJrpehzAvJFfw1xE42YRKpSHHqLg&m=YvKSGXdvGRaysNwzHzvAmlBnY6iorT9wVevdTbUPjbQ&s=ryXl7Qzxnej4YdkT8uiP1iNipk3zqQycBuewsOMqFjs&e= >

--
Steve
www.lucidworks.com

> On Jan 28, 2016, at 6:45 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
> 
> Thanks steve for prompt response.
> 
> I tried workaround one. 
> i.e.  1. Add attr_date via add-dynamic-field instead of add-field 
> (even though the name has no asterisk)
> 
> I am able to add dynamic field  attr_date. But while starting the solr , I am getting following message.
> Could not load conf for core sreenimsg: Dynamic field name 'attr_date' should have either a leading or a trailing asterisk, and no others.
> 
> So solr looking for either leading * or trailing * in the dynamic field name.
> 
> I can see similar problems in workaround 2.
> 
> Any other suggestions?
> 
> Advanced Thanks.
> --sreenivasa kallu
> 
> -----Original Message-----
> From: Steve Rowe [mailto:sarowe@gmail.com]
> Sent: Thursday, January 28, 2016 1:17 PM
> To: solr-user@lucene.apache.org
> Subject: Re: How to convert string field to date
> 
> Hi Sreenivasa,
> 
> This is a known bug: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org
> _jira_browse_SOLR-2D8607&d=CwIFaQ&c=19TEyCb-E0do3cLmFgm9ItTXlbGQ5gmhRA
> lAtE256go&r=ZV-VnW_JFfcZo8vYJrpehzAvJFfw1xE42YRKpSHHqLg&m=ZJBCYIV-H5H3
> u5j_Rrhaex68Eb9dgqZmlO6fzKNfr8s&s=qmQIR8akquwcJ83E7HZgK38lTfSug8QifJEH
> 1_ljJkk&e=
> 
> (though the problem is not just about catch-all fields as the issue 
> currently indicates - all dynamic fields are affected)
> 
> Two workarounds (neither tested):
> 
> 1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk) 2. Remove the attr_* dynamic field, add attr-date, then add attr_* back; these can be done with a single request.
> 
> I’ll update SOLR_8607 to reflect these things.
> 
> --
> Steve
> www.lucidworks.com
> 
>> On Jan 28, 2016, at 3:58 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
>> 
>> Hi,
>>      I am new to solr.
>> 
>> I am using managed-schema. I am not using schema.xml.  I am indexing outlook email messages.
>> I can see only see three fields ( id,_version_,_text_) defined in 
>> managed-schema. Remaining fields are handled by following dynamic 
>> field <dynamicField name="attr_*" type="text_general" indexed="true"
>> stored="true" multiValued="true"/>
>> 
>> I have field name attr_date with type string. I want convert this 
>> field type to date. Currently date range is not working on this field.
>> I tried schema API to add new field attr_date and got following error 
>> message "Field 'attr_date' already exists".  I tried to replace field type to date and got following error message "The field 'attr_date' is not present in this schema, and so cannot be replaced".
>> 
>> Please help me to convert "attr_date"  field type to date.
>> 
>> Advanced Thanks.
>> --sreenivasa kallu
>> 
>> 
> 


Re: How to convert string field to date

Posted by Steve Rowe <sa...@gmail.com>.
Try workaround 2, I did and it worked for me.  See my comment on the issue: <https://issues.apache.org/jira/browse/SOLR-8607?focusedCommentId=15122751&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15122751>

--
Steve
www.lucidworks.com

> On Jan 28, 2016, at 6:45 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
> 
> Thanks steve for prompt response.
> 
> I tried workaround one. 
> i.e.  1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk)
> 
> I am able to add dynamic field  attr_date. But while starting the solr , I am getting following message.
> Could not load conf for core sreenimsg: Dynamic field name 'attr_date' should have either a leading or a trailing asterisk, and no others.
> 
> So solr looking for either leading * or trailing * in the dynamic field name.
> 
> I can see similar problems in workaround 2.
> 
> Any other suggestions?
> 
> Advanced Thanks.
> --sreenivasa kallu
> 
> -----Original Message-----
> From: Steve Rowe [mailto:sarowe@gmail.com] 
> Sent: Thursday, January 28, 2016 1:17 PM
> To: solr-user@lucene.apache.org
> Subject: Re: How to convert string field to date
> 
> Hi Sreenivasa,
> 
> This is a known bug: https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_SOLR-2D8607&d=CwIFaQ&c=19TEyCb-E0do3cLmFgm9ItTXlbGQ5gmhRAlAtE256go&r=ZV-VnW_JFfcZo8vYJrpehzAvJFfw1xE42YRKpSHHqLg&m=ZJBCYIV-H5H3u5j_Rrhaex68Eb9dgqZmlO6fzKNfr8s&s=qmQIR8akquwcJ83E7HZgK38lTfSug8QifJEH1_ljJkk&e= 
> 
> (though the problem is not just about catch-all fields as the issue currently indicates - all dynamic fields are affected)
> 
> Two workarounds (neither tested):
> 
> 1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk) 2. Remove the attr_* dynamic field, add attr-date, then add attr_* back; these can be done with a single request.
> 
> I’ll update SOLR_8607 to reflect these things.
> 
> --
> Steve
> www.lucidworks.com
> 
>> On Jan 28, 2016, at 3:58 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
>> 
>> Hi,
>>      I am new to solr.
>> 
>> I am using managed-schema. I am not using schema.xml.  I am indexing outlook email messages.
>> I can see only see three fields ( id,_version_,_text_) defined in 
>> managed-schema. Remaining fields are handled by following dynamic 
>> field <dynamicField name="attr_*" type="text_general" indexed="true" 
>> stored="true" multiValued="true"/>
>> 
>> I have field name attr_date with type string. I want convert this 
>> field type to date. Currently date range is not working on this field. 
>> I tried schema API to add new field attr_date and got following error 
>> message "Field 'attr_date' already exists".  I tried to replace field type to date and got following error message "The field 'attr_date' is not present in this schema, and so cannot be replaced".
>> 
>> Please help me to convert "attr_date"  field type to date.
>> 
>> Advanced Thanks.
>> --sreenivasa kallu
>> 
>> 
> 


RE: How to convert string field to date

Posted by "Kallu, Sreenivasa (HQP)" <sr...@roberthalf.com>.
Thanks steve for prompt response.

I tried workaround one. 
i.e.  1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk)

I am able to add dynamic field  attr_date. But while starting the solr , I am getting following message.
Could not load conf for core sreenimsg: Dynamic field name 'attr_date' should have either a leading or a trailing asterisk, and no others.

So solr looking for either leading * or trailing * in the dynamic field name.

I can see similar problems in workaround 2.

Any other suggestions?

Advanced Thanks.
--sreenivasa kallu

-----Original Message-----
From: Steve Rowe [mailto:sarowe@gmail.com] 
Sent: Thursday, January 28, 2016 1:17 PM
To: solr-user@lucene.apache.org
Subject: Re: How to convert string field to date

Hi Sreenivasa,

This is a known bug: https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.apache.org_jira_browse_SOLR-2D8607&d=CwIFaQ&c=19TEyCb-E0do3cLmFgm9ItTXlbGQ5gmhRAlAtE256go&r=ZV-VnW_JFfcZo8vYJrpehzAvJFfw1xE42YRKpSHHqLg&m=ZJBCYIV-H5H3u5j_Rrhaex68Eb9dgqZmlO6fzKNfr8s&s=qmQIR8akquwcJ83E7HZgK38lTfSug8QifJEH1_ljJkk&e= 

(though the problem is not just about catch-all fields as the issue currently indicates - all dynamic fields are affected)

Two workarounds (neither tested):

1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk) 2. Remove the attr_* dynamic field, add attr-date, then add attr_* back; these can be done with a single request.

I’ll update SOLR_8607 to reflect these things.

--
Steve
www.lucidworks.com

> On Jan 28, 2016, at 3:58 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
> 
> Hi,
>       I am new to solr.
> 
> I am using managed-schema. I am not using schema.xml.  I am indexing outlook email messages.
> I can see only see three fields ( id,_version_,_text_) defined in 
> managed-schema. Remaining fields are handled by following dynamic 
> field <dynamicField name="attr_*" type="text_general" indexed="true" 
> stored="true" multiValued="true"/>
> 
> I have field name attr_date with type string. I want convert this 
> field type to date. Currently date range is not working on this field. 
> I tried schema API to add new field attr_date and got following error 
> message "Field 'attr_date' already exists".  I tried to replace field type to date and got following error message "The field 'attr_date' is not present in this schema, and so cannot be replaced".
> 
> Please help me to convert "attr_date"  field type to date.
> 
> Advanced Thanks.
> --sreenivasa kallu
> 
> 


Re: How to convert string field to date

Posted by Steve Rowe <sa...@gmail.com>.
Hi Sreenivasa,

This is a known bug: https://issues.apache.org/jira/browse/SOLR-8607

(though the problem is not just about catch-all fields as the issue currently indicates - all dynamic fields are affected)

Two workarounds (neither tested):

1. Add attr_date via add-dynamic-field instead of add-field (even though the name has no asterisk)
2. Remove the attr_* dynamic field, add attr-date, then add attr_* back; these can be done with a single request.

I’ll update SOLR_8607 to reflect these things.

--
Steve
www.lucidworks.com

> On Jan 28, 2016, at 3:58 PM, Kallu, Sreenivasa (HQP) <sr...@roberthalf.com> wrote:
> 
> Hi,
>       I am new to solr.
> 
> I am using managed-schema. I am not using schema.xml.  I am indexing outlook email messages.
> I can see only see three fields ( id,_version_,_text_) defined in managed-schema. Remaining fields are
> handled by following dynamic field
> <dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>
> 
> I have field name attr_date with type string. I want convert this field type to date. Currently date range is not
> working on this field. I tried schema API to add new field attr_date and got following error message
> "Field 'attr_date' already exists".  I tried to replace field type to date and got following error message
> "The field 'attr_date' is not present in this schema, and so cannot be replaced".
> 
> Please help me to convert "attr_date"  field type to date.
> 
> Advanced Thanks.
> --sreenivasa kallu
> 
>