Hi Michael,

I forgot to include what I did for one customer :

1) Using StatsComponent I get min and max values of the field (year)
2) Calculate "smart gap/range values" according to minimum and maximum.
3) Re-issue the same query (for thee second time) that includes a set of 
facet.query.

Ahmet



On Monday, March 3, 2014 10:30 PM, Ahmet Arslan <iori...@yahoo.com> wrote:
Hi,

Regarding "just a simple subtraction" you do it in indexer code or in a update 
prcessor too. You can either modify original field or you can create an 
additional one. Java-script could be used : 
http://wiki.apache.org/solr/ScriptUpdateProcessor

Ahmet



On Monday, March 3, 2014 9:11 PM, Michael Lackhoff <mich...@lackhoff.de> wrote:
Hi Ahmet,

> There is no built in solution for this.

Yes, I know, that's why I would like the TokenFilterFactory

> Two workaround :
> 
> 1) use facet.limit=-1 and invert the list (faceting response) at client side
> 
> 2) use multiples facet.query
>    a)facet.query=year:[2012 TO 2014]&facet.query=year:[2010 TO 2012] 
>    b)facet.query=year:2014&facet.query=year:2013 ...

I thought about these but they have the disadvantage that 1) could
return hundreds of facet entries. 2b) is better but would need about 30
facet-queries which makes quite a long URL and it wouldn't always work
as expected. There are subjects that were very popular in the past but
with no (or very few) recent publications. For these I would get empty
results for my 2014-1985 facet-queries but miss all the stuff from the
1960s.

From all these thoughts I came to the conclusion that a custom
TokenFilterFactory could do exactly what I want. In effect it would give
me a reverse sort:
10000 - 2014 = 7986
10000 - 2013 = 7987
...
The client code can easily regain the original year values for display.

And I think it shouldn't be too difficult to write such a beast, only
problem is I am not a Java programmer. That is why I asked if someone
has done it already or if there is a guide I could use.
After all it is just a simple subtraction...


-Michael

Reply via email to