Thanks for the feedback Levan! Could you open a JIRA issue for unique() on numeric/date fields? We don't yet have explicit numeric support for unique() and I think some changes in Lucene 5 broke treating these fields as strings (i.e. the ability to retrieve ords).
-Yonik On Thu, Apr 16, 2015 at 7:46 AM, levanDev <levandev9...@gmail.com> wrote: > Hello, > > We are looking at a couple of options for using solr to dynamically calulate > unique values per field. In testing out Solr 5.1, I've been using the > unique() facet function: > > http://yonik.com/solr-facet-functions/ > > Overall, loving the JSON Facet API, especially the sub-faceting thus far. > > Here's my two part question: > > I. When I use the unique aggregation function on a "string" field > (uniqueValues:'unique(myStringField)'), it works as expected, returns the > number of unique fields. However when I pass in an int -- or date -- field > (uniqueValues:'unique(myIntField)') the resulting count is 0. The cause > might be something else, but if it can be replicated by another user, would > be great to discuss the unique function further -- in our current use-case, > we have a field where under 20 unique values are present but the values are > ints. > > II. Is there a way to use the stats.calcdistinct functionality and only > return the countDistinct portion of the response and not the full list of > distinct values -- as provided in the distinctValues portion of the > response. In a field with high cardinality the response size becomes too > large. > > If there is no such option, could someone point me in the right direction > for implementing a custom solution? > > Thank you for your time, > Levan