Esempio n. 1
0
        public AlgoliaBaseIndex(string name, IAlgoliaRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentOutOfRangeException(nameof(name));
            }

            Name = name;

            _repository     = repository;
            this.Strategies = new List <IIndexUpdateStrategy>();
        }
        public AlgoliaSearchIndexSummary(
            IAlgoliaRepository repository,
            IIndexPropertyStore propertyStore)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (propertyStore == null)
            {
                throw new ArgumentNullException(nameof(propertyStore));
            }

            _repository    = repository;
            _propertyStore = propertyStore;
        }
        public AlgoliaUpdateContext(
            ISearchIndex index,
            IAlgoliaRepository repository)
        {
            if (index == null)
            {
                throw new ArgumentNullException(nameof(index));
            }
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            _index      = index;
            _repository = repository;

            _updateDocs = new Dictionary <string, JObject>();
            _deleteIds  = new List <ID>();
        }
        public LinqToAlgoliaIndex(AlgoliaSearchContext context,
                                  IExecutionContext executionContext)
        {
            Assert.ArgumentNotNull(context, "context");
            _context = context;

            var index = context.Index as AlgoliaBaseIndex;

            if (index == null)
            {
                throw new ArgumentException("context.Index should be instance of AlgoliaBaseIndex");
            }

            _repository          = index.Repository;
            _configuration       = context.Index.Configuration;
            _queryOptimizer      = new AlgoliaQueryOptimizer();
            _mapper              = new AlgoliaQueryMapper();
            _fieldNameTranslator = context.Index.FieldNameTranslator;
        }