public bool ShouldUpdateIndex(ISearchIndex searchIndex, ISearchIndexSummary searchIndexSummary)
        {
            // Always update when index has been explicitly set as to update
            if (_indexesToUpdate != null && _indexesToUpdate.Contains(searchIndex))
            {
                return(true);
            }

            // Only update when index is not empty: updating an empty index would trigger a rebuild.
            return(searchIndexSummary.NumberOfDocuments > 0);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            _summary = new AlgoliaSearchIndexSummary(_repository, PropertyStore);

            var config = this.Configuration as AlgoliaIndexConfiguration;

            if (config == null)
            {
                throw new ConfigurationErrorsException("Index has no configuration.");
            }

#if SITECORE8
            initialized = true;
#endif
        }