Nkl Kumar
Nkl Kumar

Reputation: 41

In Solr, how to get all the unique values from a field? there are more than 100 values?

Below query gives be the unique values of that field. But it returns only top 100. Not sure how to get all the unique values.

"'http://localhost:8983/solr/select/?q=%3A&rows=0&facet=on&facet.field=txt'"

PS: My field is a tokenized field. Not sure if that makes any difference.

Upvotes: 0

Views: 427

Answers (1)

MatsLindh
MatsLindh

Reputation: 52912

You can use facet.limit to change the number of returned values. Set it to -1 to make Solr return all possible values for a field and not just the top 100.

&facet=on&facet.field=txt&facet.limit=-1

You can also use f.txt.facet.limit=-1 if you have more than one facet and just want to change the value for that single field.

You can also use the Terms component to retrieve the tokens indexed for a specific field - depending on your use case it might be more efficient to use the terms component instead - you'll have to evaluate the performance for your exact use case and setup.

Upvotes: 3

Related Questions