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 dhimant <dh...@gmail.com> on 2014/08/17 14:35:20 UTC

Custom stat aggregation and sorting function in solr

Please provide suggestion/example to create a custom stat[Aggregate] function
in the Solr. Every document in Solr is having 30 String, 10 int and 1
binary[hashset to store unique users] fields. I want to add a new stat
function (UniqueUsers(fieldName) like add/avg function already available in
Solr) to find the unique across searched Solr records.

While googling, i found following Issue ticket SOLR-5302 ,which is already
resolved ,but i dint find any example to implement it.
https://issues.apache.org/jira/browse/SOLR-5302


I found one of the stat collector here.

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/UniqueStatsCollector.java

how can i add a custom stat attribute, register it with Solr[ how to build
solr with new stat attribute ]?



--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-stat-aggregation-and-sorting-function-in-solr-tp4153387.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom stat aggregation and sorting function in solr

Posted by Yonik Seeley <yo...@heliosearch.com>.
On Sun, Aug 17, 2014 at 7:27 AM, dhimant <dh...@gmail.com> wrote:
> Hi Yonik,
> Thanks for the reply.
> But i want a unique function on my binary column. This column contains
> binary representation of java hashset.

Ah, got it...  hopefully it's your own binary format and not Java
serialization (the latter would be too slow).
I don't think any analytics options currently have a way to easily
plug in custom functions.

There is something for custom analytics that doesn't integrate with
any of the other analytics options:
http://heliosearch.org/solrs-new-analyticsquery-api/

I am actually working on a way to easily plug in custom analytics into
heliosearch facet functions, but it's not done yet.

Another option you can consider is using a multi-valued string field
instead instead of a custom binary format... it will allow a lot more
functionality out of the box.

-Yonik
http://heliosearch.org - native code faceting, facet functions,
sub-facets, off-heap data

Re: Custom stat aggregation and sorting function in solr

Posted by dhimant <dh...@gmail.com>.
Hi Yonik,
Thanks for the reply.
But i want a unique function on my binary column. This column contains
binary representation of java hashset.

I found stat functions available @ following location.
https://github.com/apache/lucene-solr/tree/trunk/solr/core/src/java/org/apache/solr/analytics/statistics

I believe I can add my own unique_Binary function.
Can you provide some ideas to implement and register new stat functions in
Solr.



--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-stat-aggregation-and-sorting-function-in-solr-tp4153387p4153392.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom stat aggregation and sorting function in solr

Posted by Yonik Seeley <yo...@heliosearch.com>.
On Sun, Aug 17, 2014 at 2:35 AM, dhimant <dh...@gmail.com> wrote:
> I want to add a new stat
> function (UniqueUsers(fieldName) like add/avg function already available in
> Solr) to find the unique across searched Solr records.

Heliosearch (a solr fork) has this:
http://heliosearch.org/solr-facet-functions/

facet.stat=unique(fieldName)

-Yonik
http://heliosearch.org - native code faceting, facet functions,
sub-facets, off-heap data