How do you configure Lucene in Sitecore to only index the latest version of an item on the master db?

You can implement a custom crawler that overrides the following:

public class IndexCrawler : DatabaseCrawler
{
    protected override void IndexVersion(Item item, Item latestVersion, Sitecore.Search.IndexUpdateContext context)
    {
        if (item.Versions.Count > 0 && item.Version.Number != latestVersion.Version.Number)
            return;

        base.IndexVersion(item, latestVersion, context);
    }
}

This ensures that only the latest version of an item gets into your Index, and therefore will be the only item pull out of said index

You would need to update your configuration file to set the correct type for the index of course


In Sitecore 7 a field _latestversion was added to the index, containing a '1' for the latest version (other versions have empty value).


If you let Lucene search in your Web database instead of the Master, it should only index the last published version.

<Database>web</Database>