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 Bernadette Houghton <be...@deakin.edu.au> on 2009/08/12 03:45:13 UTC

Indexing date into multiple fields

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: bern_houghton@hotmail.com
Email: bernadette.houghton@deakin.edu.au<ma...@deakin.edu.au>
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


Re: Indexing date into multiple fields

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Aug 12, 2009 at 7:15 AM, Bernadette Houghton <
bernadette.houghton@deakin.edu.au> 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.