0

The standard way that Solr builds the index is with an Inverted index, this makes search very fast & efficient.Well I am clear with Inverted & Backward indexes, but why Inverted Index is not good when it comes for Faceting or Sorting the data ? I Googled it, but got no satisfactory explanation.

PS : We use DocValues field type for fields needs to be used while Faceting or Sorting (DocValue fields are now column-oriented fields with a document-to-value mapping built at index time).

Anyone has got a clear explanantion for this ? Thanks

Dimag Kharab
  • 4,439
  • 1
  • 24
  • 45

1 Answers1

1

The reason is that it's expensive to compute the count of documents actually containing the facets. For each term you're practically doing a search for that term and intersecting it with the set of documents that you've already retrieved, finding out how many documents is contained in both the previous and the new set. The inverted index doesn't provide anything (directly) useful to do this.

There is a lot of literature available on the subject, and a discussion would be too broad for what a stack overflow answer can provide. The "What is in a Lucene index?" presentation from last year's Lucene Solr Revolution also provides some insight.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • thanks much! I have some other doubts too in solr, kind of noob right now – Dimag Kharab Nov 20 '14 at 20:21
  • @CodingAnt You probably don't have to think too much about the low level concepts in the beginning, unless you're actually having performance issues in those areas. – MatsLindh Nov 20 '14 at 20:26