The Sitecore ContentSearch API allows you to index content in either .NET Lucene or SOLR, dramatically speeding up retrieval of content, especially when querying items that are scattered across your content tree.
Content retrieved from the ContentSearch API is not Sitecore Content Items (of type Sitecore.Data.Items.Item), they are objects that you have defined yourself. This is why you will experience that when querying from the MASTER database index (SITECORE_MASTER_INDEX), you will receive one result per version (and one result per language) rather than one Item object containing all versions and languages.
To overcome this issue, Sitecore have added a few nifty fields to the index, for example the _latestversion field:
So when querying the index, you can add the _latestversion field:
query = query.Where(item => item["_latestversion"].Equals("1"));
BTW, _latestversion is defined in a constant value in Sitecore:
Sitecore.ContentSearch.BuiltinFields.LatestVersion;
MORE TO READ:
- A re-introduction to the ContentSearch API in Sitecore – Part 1 by Søren Engel
- A re-introduction to the ContentSearch API in Sitecore – Part 2 by Søren Engel
- Sitecore Content search multiple versions of same document from StackOverflow
