Toke thanks for a quick reply. I am still confused, pls find the doubts I have inline:
On Mon, May 11, 2015 at 1:22 PM Toke Eskildsen <t...@statsbiblioteket.dk> wrote: > On Mon, 2015-05-11 at 05:48 +0000, Abhishek Gupta wrote: > > According to this there are 137 records. Now I am faceting over these 137 > > records with facet.method=fc. Ideally it should just iterate over these > 137 > > records and sub up the facets. > > That is only the ideal method if you are not planning on issuing > subsequent calls: facet.method=fc does more work up front to ensure that > later calls are fast. > > http://localhost:9020/search/p1-umShard-1/select?q=*:*& > > fq=(msgType:38+AND+snCreatedTime:[2015-04-15T00:00:00Z%20TO%20*])& > > facet.field=conversationId&facet=true&indent=on&wt=json&rows=0& > > facet.method=fc&debug=timing > > { > > > > - responseHeader: > > { > > - status: 0, > > - QTime: 395103 > > }, > > [...] > > > According to this faceting is taking 395036 time. Why its taking *395 > > seconds* to just calculate facets of 137 records? > > 6½ minute is a long time, even for first call. Do you have tens to > hundreds of millions of documents in your index? Or do you have a > similiar amount of unique values in your facet? > Yes we have that many documents (exact count: 522664425), but I am not sure why that matters because what I understood from documentation <https://wiki.apache.org/solr/SimpleFacetParameters#facet.method> is that *fc* will only work on the documents filtered by filter query and query. For my query there are only 137 documents for fc to work on and to make *FieldCache*. But seeing the faceting result it seems that faceting is being applied on all the documents which is not according to documentation "*The facet counts are calculated by iterating over documents that match the query and summing the terms that appear in each document"*. I am not able to understand why fc is calculating facets over all the documents? Just for your information the cardinality of the field(conversationId) on which I am faceting is very high but the possible values for this field matching my query and filter query is about 100 only. > Either way, subsequent faceting calls should be much faster and a switch > to DocValues should lower your first-call time significantly. > Also subsequent calls are not fast: First call time: 297572 Second call time (made with in 2 sec): 249287 Yeah I agree docValues will reduce the time. > > Toke Eskildsen, State and University Library, Denmark > > >