Hi Guys,

I need a bit of help.

I want to produce frequency analysis of all tokens inside my solr Index from
a specific (content) field.

When I use TermsComponent or FacetCounts, what I get is how many records or
documents each term appears in (which again confuses me as to what the
difference is, is it facets are restricted to terms in result set and
termscomponent is not restricted by the query?).  Is there yet a way to get
total terms count (not per document but across the whole index)?  I have
tried searching in archieves and across web but closest match I found is
this: http://search-lucene.com/m/of5Fn1PUOHU/

It is suggested in this post that I can post the mentioned lines of code
into TermsComponent.java and it should work.  However, the code seems to
have changed since and when I try this, the Class TermDocs is not even
recognized.

I was wondering if there is any other way by using Lucene or Solr to do
this.  I will be very grateful for any reply.  If it helps, below is the
code I am running right now which gives me document count and not Terms
count.

        String queryString = "document:*";

        SolrQuery solrQuery = new SolrQuery();
        solrQuery.setQuery(queryString);
        solrQuery.setQueryType("/terms");
        solrQuery.setTerms(true);
        solrQuery.setTermsLimit(20);
        solrQuery.setParam("terms.fl", "document");
        solrQuery.setTermsSortString("count");

        QueryResponse solrResp = conf._solr.executeQuery(solrQuery, 0, 10);

        TermsResponse termsResp = solrResp.getTermsResponse();
        List<TermsResponse.Term> terms = termsResp.getTerms("document");

Ignore the conf object and _solr variable thats just my internal singleton
object.

Thanks,
Ravish Bhagdev

Reply via email to