facets=true&facet.field=field // SELECT count(distinct(field)) &fq=field:[* TO *] // WHERE length(field) > 0 &q=other_criteriaA&fq=other_criteriaB// AND other_criteria
advantage: you can look into several fields at one time when adding another facet.field disadvantage: you get the counts splitted by the values of that field fix this via field collapsing / results grouping http://wiki.apache.org/solr/FieldCollapsing or use deduplication: http://wiki.apache.org/solr/Deduplication Regards, Peter. > Hi, > > Is there a way with faceting or field collapsing to do the SQL equivalent of > > SELECT count(distinct(field)) FROM index WHERE length(field) > 0 AND > other_criteria > > i.e. I'm only interested in the total count not the individual records > and counts. > > Cheers, > Dan -- http://jetwick.com open twitter search