Esempio n. 1
0
        public MongoCatalog(MongoConnector <TData> connector, IFilterCreator <TFilterQuery, TData> filterCreator)
        {
            _idPropName = connector.IdProdName;
            _mols       = connector.Mols;

            Init.ForType <TData>(_idPropName);

            _filterCreator = filterCreator;
        }
Esempio n. 2
0
        public MongoTextSearch(MongoConnector <TData> connector, int hitLimit, params string[] textIndexFields)
        {
            if (textIndexFields.Length < 1)
            {
                throw new ArgumentException("there must be at least one text index field");
            }

            _mols            = connector.Mols;
            _hitLimit        = hitLimit;
            _textIndexFields = textIndexFields.ToArray();

            var indexKeys = Builders <TData> .IndexKeys;

            _mols.Indexes.CreateMany(_textIndexFields.Select(f => new CreateIndexModel <TData>(indexKeys.Hashed(f))));
        }
Esempio n. 3
0
        public static Reindexer.DataSourceDelegate CreateReindexerDataSource <TData>(this MongoConnector <TData> connector) where TData : ISearchIndexItemWithTime
        {
            var indexKeys = Builders <TData> .IndexKeys;

            connector.Mols.Indexes.CreateOne(indexKeys.Ascending(nameof(ISearchIndexItemWithTime.LastUpdated)));

            return(async(since, skip, maxCount)
                   => (await connector.Mols
                       .Find(m => m.LastUpdated > since)
                       .SortBy(m => m.LastUpdated)
                       .Skip(skip)
                       .Limit(maxCount)
                       .ToListAsync())
                   .Cast <ISearchIndexItemWithTime>());
        }
Esempio n. 4
0
 public static ICatalogDb <string, TFilterQuery, TData> CreateCatalogDb <TFilterQuery, TData>(this MongoConnector <TData> connector, IFilterCreator <TFilterQuery, TData> filterCreator)
 => new MongoCatalog <TFilterQuery, TData>(connector, filterCreator);
Esempio n. 5
0
 public static ITextSearch <TData> CreateTextSearch <TData>(this MongoConnector <TData> connector, int hitLimit, params string[] textIndexFields)
 => new MongoTextSearch <TData>(connector, hitLimit, textIndexFields);