You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mirko Torrisi <mi...@ucdconnect.ie> on 2015/03/02 19:00:44 UTC

Fill up field date using file name or path

Hi folks,

Hopefully this is an easy question but I couldn't do it after several 
hours..

I created a new field (adding <field name="date" type="date" 
indexed="true" stored="true"/>) and I'd like to fill out it using the 
filename or the file path.
The file names are like: TEXT_CRE_YYYYMMGG_X-XXX-XXX.txt or 
TEXT_CRE_YYYYMMGG_X-XXX.txt (where every X are random numbers).
The files are divided in directory following this rule: 
/YYYY/MM/**filename**.

I don't know which way is easier (filename or path). I'd like to use a 
date field type to be able to use some group functions.


Thank in advance.
Have a nice week,

Mirko

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Fill up field date using file name or path

Posted by Erick Erickson <er...@gmail.com>.
There's nothing automatic that'll make a "best guess" about turning
some substring of the incoming field into a date.

You could create a custom update component to handle this case, or you
could massage the data on the ingestion
side to populate this field, but it'll be custom code one way or the other.

Best,
Erick

On Mon, Mar 2, 2015 at 10:00 AM, Mirko Torrisi
<mi...@ucdconnect.ie> wrote:
> Hi folks,
>
> Hopefully this is an easy question but I couldn't do it after several
> hours..
>
> I created a new field (adding <field name="date" type="date" indexed="true"
> stored="true"/>) and I'd like to fill out it using the filename or the file
> path.
> The file names are like: TEXT_CRE_YYYYMMGG_X-XXX-XXX.txt or
> TEXT_CRE_YYYYMMGG_X-XXX.txt (where every X are random numbers).
> The files are divided in directory following this rule:
> /YYYY/MM/**filename**.
>
> I don't know which way is easier (filename or path). I'd like to use a date
> field type to be able to use some group functions.
>
>
> Thank in advance.
> Have a nice week,
>
> Mirko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org