Hi Ufuk,

Thanks for the tips !

It works fine with this :

http://localhost:8983/solr/db001/select?
        facet.contains.ignoreCase=true
        &fl=ap,in
        &indent=true
        &q.op=OR
        &q=ti%3Atreat*
        &rows=1
        &facet=true
        &facet.range.gap=%2B1YEAR (the GAP)
        &facet.range=pd (field to count)
        &facet.range.start=1800-01-01T23:59:59Z (date start)
        &facet.range.end=2024-07-01T23:59:59Z (date end, I don't know yet how 
can I tell "take all")
        &facet.mincount=1 (To delete frequency = 0)

Thanks a lot !

PS: I continue to search how to indicate "take all"


Cordialement, Best Regards
Bruno Mannina
www.matheo-software.com
www.patent-pulse.com
Mob. +33 0 634 421 817


-----Message d'origine-----
De : ufuk yılmaz [mailto:uyil...@vivaldi.net.INVALID]
Envoyé : lundi 1 juillet 2024 15:38
À : users@solr.apache.org
Objet : Re: Get only year from a date field for a copy field ?

Hi Bruno,

Did you consider using a range facet with gap being 1 year? If that works for 
you, you can avoid reindexing altogether.

https://solr.apache.org/guide/8_1/json-facet-api.html

Try specifying gap as "1YEARS" or "+1YEARS" (I forgot if plus sign was required 
or not)

Sincerely
Ufuk Yilmaz

—

> On Jul 1, 2024, at 17:51, Bruno Mannina <bmann...@matheo-software.com> wrote:
>
> Hi Solr Team,
>
>
>
> Is it possible to create a copy field where the source is a date-time
> field to extract only the year ?
>
>
>
> I have 2024-07-01T253:59:59Z for the date field and store/index a copy
> field with only 2024.
>
>
>
> The goal is to have faceting only on Year information.
>
>
>
> Note: I haven't the possibility to re-create my source files to index
> due to the huge volume (more than 15To of data).
>
> Note2: my index is not yet build.
>
>
>
> Cordialement, Best Regards
>
> Bruno Mannina
>
> <http://www.matheo-software.com/> www.matheo-software.com
>
> <http://www.patent-pulse.com/> www.patent-pulse.com
>
> Mob. +33 0 634 421 817
>
>
>
>
>
> --
> Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
> www.avast.com


--
Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
www.avast.com

Reply via email to