Example #1
0
        /// <summary>
        /// 索引处理
        /// </summary>
        /// <param name="type">索引类型</param>
        /// <param name="log"></param>
        public DataInit(string type, ILog log)
        {
            _log         = log;
            _indexType   = type;
            _indexConfig = IndexConfigHelper.IndexConfig(type);
            if (_indexConfig == null)
            {
                throw new Exception(string.Format("{0}:未找到对应索引类型的配置信息!", _indexType));
            }
            _log.Info(string.Format("{0}:开始操作索引...", type));
            tempIndexName = _indexConfig.IndexName + DateTime.Now.ToString("yyyyMMddHHmmss");
            //es操作对象
            _es = new EsHandle(tempIndexName, _log);
            //创建一个索引
            _es.CreateIndex(_indexConfig.Replicas, _indexConfig.Shards);
            try
            {
                _log.Info(string.Format("{0}:索引操作完成...", type));
                //索引器容器
                _indexerContainer = new IndexerContainer(_log);

                _log.Info(string.Format("{0}:开始索引数据...", type));
            }
            catch
            {
                //有异常删除已创建的索引
                _es.DeleteIndex(tempIndexName);
                throw;
            }
        }
Example #2
0
 protected IndexerBase(int pageSize, IEsHandle es, ILog log)
 {
     PageSize = pageSize;
     Es       = es;
     _log     = log;
     Es.Mapping <T>();
     pageQueue = GeneratePageQueue();
 }
Example #3
0
        /// <summary>
        /// 需要分页索引器
        /// </summary>
        /// <param name="indexType"></param>
        /// <param name="pagesize"></param>
        /// <param name="es"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public IIndexer ResolveIndexer(string indexType, int pagesize, IEsHandle es)
        {
            if (!_iocContainer.IsRegisteredWithName <IIndexer>(indexType.ToLower()))
            {
                throw new Exception(indexType + "的实现为注册!");
            }

            return(_iocContainer.ResolveNamed <IIndexer>(indexType.ToLower(), new Parameter[]
            {
                new TypedParameter(typeof(int), pagesize),
                new TypedParameter(typeof(IEsHandle), es),
                new TypedParameter(typeof(ILog), _log)
            }));
        }
 public DealerMainBrandIndexer(IEsHandle es, ILog log) : base(es, log)
 {
 }
Example #5
0
 protected IndexerSimpleBase(IEsHandle es, ILog log)
 {
     Es   = es;
     _log = log;
     Es.Mapping <T>();
 }
Example #6
0
 public DeleteManyHandle(DeleteTaskConfig config, ILog log)
 {
     _config = config;
     _log    = log;
     _es     = new EsHandle(config.IndexName, log, 50000);
 }
Example #7
0
 public ArticleIndexer(IEsHandle es, ILog log)
     : base(es, log)
 {
 }
Example #8
0
 public CommentIndexer(IEsHandle es, ILog log)
     : base(es, log)
 {
 }
Example #9
0
 public VendorInfoIndexer(IEsHandle es, ILog log) : base(es, log)
 {
     _log = log;
 }
 public VendorPromotionNewsIndexer(IEsHandle es, ILog log)
     : base(es, log)
 {
     _log = log;
 }
 public VendorAndCarSerialPromotionNewsIndexer(IEsHandle es, ILog log) : base(es, log)
 {
 }