Indexing date into multiple fields

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Indexing date into multiple fields

bernieh
Am very new to SOLR, so this question may seem overly basic  -

In schema.xml, I have a date field type -

    <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>

used by -

   <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
   <dynamicField name="*_mdt" type="date"    indexed="true"  stored="true" multiValued="true" />

and want to create additional indexes based on variations of the date, e.g. year, decade (which can then be used as facets). I'm assuming I need to set up another field type and apply a suitable tokenizer?? Is this correct, and if so, which tokenizer?

TIA
Bernadette Houghton, Library Business Applications Developer
Deakin University Geelong Victoria 3217 Australia.
Phone: 03 5227 8230 International: +61 3 5227 8230
Fax: 03 5227 8000 International: +61 3 5227 8000
MSN: [hidden email]
Email: [hidden email]<mailto:[hidden email]>
Website: http://www.deakin.edu.au
<http://www.deakin.edu.au/>Deakin University CRICOS Provider Code 00113B (Vic)

Important Notice: The contents of this email are intended solely for the named addressee and are confidential; any unauthorised use, reproduction or storage of the contents is expressly prohibited. If you have received this email in error, please delete it and any attachments immediately and advise the sender by return email or telephone.
Deakin University does not warrant that this email and any attachments are error or virus free

Reply | Threaded
Open this post in threaded view
|

Re: Indexing date into multiple fields

Shalin Shekhar Mangar
On Wed, Aug 12, 2009 at 7:15 AM, Bernadette Houghton <
[hidden email]> wrote:

> Am very new to SOLR, so this question may seem overly basic  -
>
> In schema.xml, I have a date field type -
>
>    <fieldType name="date" class="solr.DateField" sortMissingLast="true"
> omitNorms="true"/>
>
> used by -
>
>   <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
>   <dynamicField name="*_mdt" type="date"    indexed="true"  stored="true"
> multiValued="true" />
>
> and want to create additional indexes based on variations of the date, e.g.
> year, decade (which can then be used as facets). I'm assuming I need to set
> up another field type and apply a suitable tokenizer?? Is this correct, and
> if so, which tokenizer?
>

You can extract the year/decade prior to indexing and put into a separate
field. There is no tokenizer in Solr/Lucene which will parse dates. However,
I guess the PatternTokenizer can be used to do parse out the year etc.

--
Regards,
Shalin Shekhar Mangar.