Search code examples
searchsolruniquedistinctsolr8

How to do a "distinct" (unique) query in the Solr 8 web interface?


We use a Solr 8.11.2 server. Also we use the Solr 8 web user interface to query the Solr cores.

How can I make a "distinct" (unique) query using this interface? In my example I want to know how many different values for the field "site" there are.

enter image description here

I read I can use the "Facet" option. But I only found very old posts (for Solr 4 and Solr 5), and nothing I read worked.

Can someone tell me what to input to get the distinct values for the field "site" (or any other field)?

Thanks


Solution

  • The faceting option would work in this case. You can try below query

    localhost:8983/solr/select/?q=*%3A*&rows=0&facet=on&facet.field=site
    

    Faceting is the arrangement of search results into categories based on indexed terms.

    Searchers are presented with the indexed terms, along with numerical counts of how many matching documents were found were each term. Faceting makes it easy for users to explore search results, narrowing in on exactly the results they are looking for

    More on faceting can be found on the solr page solr faceting