2
votes

I am using syncMaster lucence index strategy (because I want real time data)

<strategies hint="list:AddStrategy">
    <strategy ref="contentSearch/indexUpdateStrategies/syncMaster" />
</strategies>

I am using Luke - Lucene Index Toolbox to view the index documents.The question I want to ask is, When I rebuild the index my_country_index. And I know there are 6 country items in sitecore for which I rebuild the index. So with Luke I see 6 documents.

For one of above item with ID '{DEA26CDA-9EA9-4F67-BB3F-13CAF6A68061}' with every update for this Item I see an additional document is added (I see with Like). So in the index I have this item with old and new data. Is it the correct behavior for the syncMaster strategy.

1
If you are not creating a new version, but just saving the item which adds another entry in the index, then you might be missing the _uniqueid field in your index configuration: stackoverflow.com/a/26096271/5358985Søren Kruse
Yes you are right I was missing the _uniqueid field. I added it and now its working. Thanks!!!! You made my day.Kamran

1 Answers

0
votes

Yes this is normal behaviour in Sitecore if your index are related master database. On web database you have just one version for every language of an item.

You can implement a custom crawler that overrides custom behaviour:

public class CustomIndexCrawler : 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 will force on indexing to have just last version of an item. You need to assign this custom crawler to your class

Other option is when you query results to get just the latest version. You need to check if _latestversion equals to 1.