I was thinking of doing a copy field to a special tokenizer I can't use a regex because I want to get a decimal value for the hour+ minutes so I need to calculate that. It's not just part for the date string.
So I'll calculate 60*hours + minutes / 60 and put it into a double field for hour of the day -----Original Message----- From: Erick Erickson <erickerick...@gmail.com> Sent: Wednesday, June 19, 2019 1:34 PM To: solr-user@lucene.apache.org Subject: Re: creating date facets *** WARNING *** EXTERNAL EMAIL -- This message originates from outside our organization. There are two approaches I might use, which is really up to you. - You can do a regex filter. So define your extra fields as you want, then use a regex charFilter (NOT filter, you want to transform the entire input) to peel out the separate parts. Then copyfield to each one, each with a different regex to peel out the correct part. - use a ScriptUpdateProcessor to do whatever you want in the scripting language you’re most comfortable with. Note that the SolrDocument that’s handled by a SUP is just a map of key:value pairs and you can modify it as you see fit. Best, Erick > On Jun 19, 2019, at 10:25 AM, Nightingale, Jonathan A (US) > <jonathan.nighting...@baesystems.com> wrote: > > Hi all, > I'm trying to have a date field automatically generate some facets of itself, > like hour of the day and hour of the week as examples, when its stored. I was > looking at this tutorial and it deemed to almost do what I wanted > > https://nathanfriend.io/2017/06/26/smart-date-searching-with-solr.html > > I was wondering if there was a way to use these filters and tokenizers to > generate values for different fields. Maybe in conjunction with a copyfield? > > I'd like it to work whenever a *_c (calendar) field is indexed it also > indexes the hour of the day (hod_d) and hor of week (how_d) fields as well. > > Any thoughts? > > Thanks!