Exemplo n.º 1
1
        private void ToggleProgress(bool forceProgressDisplay)
        {
            IFullTextSearchService searchService = AbleContext.Resolve <IFullTextSearchService>();

            if (searchService.LastReindexDate != null && !searchService.IsReindexing && !forceProgressDisplay)
            {
                LastRebuildDate.Text     = string.Format(LastRebuildDate.Text, searchService.LastReindexDate.Value);
                LastRebuildPanel.Visible = true;
            }
            else
            {
                LastRebuildPanel.Visible = false;
            }

            if (searchService.IsReindexing || forceProgressDisplay)
            {
                int seconds = 1;
                if (searchService.IsReindexing)
                {
                    seconds = (int)Math.Ceiling(LocaleHelper.LocalNow.Subtract(searchService.ReindexStartDate.Value).TotalSeconds);
                }
                int minutes = seconds / 60;
                seconds                    = seconds - (60 * minutes);
                ProgressLabel.Text         = string.Format(ProgressLabel.Text, minutes, seconds);
                ProgressPanel.Visible      = true;
                RebuildIndexButton.Visible = false;
                Timer1.Enabled             = true;
            }
            else
            {
                ProgressPanel.Visible      = false;
                RebuildIndexButton.Visible = true;
            }
        }
Exemplo n.º 2
0
 public OTAUIController(IOTAUIService otaUIService, IOTARedisService redisService, IFileService fileService, IUserAccessDataControlService userAccessDataControlService, IMembershipService membershipService, IFullTextSearchService fullTextSearchService)
     : base(otaUIService, redisService, fileService, fullTextSearchService)
 {
     this.UserAccessDataControlService = userAccessDataControlService;
     this.MembershipService = membershipService;
     StatusOTAService = StructureMap.ObjectFactory.GetInstance<IStatusOTAService>();
 }
Exemplo n.º 3
0
 public CommonController(ICommonService commonSvc, IFullTextSearchService fullTextSearchService, IIMEICacheService imeiCacheService, ISqlLoaderWriter logService)
 {
     CommonService = commonSvc;
     FullTextSearchService = fullTextSearchService;
     IMEICacheService = imeiCacheService;
     LogService = logService;
 }
Exemplo n.º 4
0
 public AppStoresUIController(IAppStoreUIService appStoreUIService, IRedisService redisService, IFileService fileService, IFullTextSearchService fullTextSearchService)
     : base(appStoreUIService, redisService, fileService, fullTextSearchService)
 {
     this.UIService = appStoreUIService;
     this.RedisService = redisService;
     this.FileService = fileService;
 }
Exemplo n.º 5
0
 PerformFullTextSearchAsync(IFullTextSearchService fullTextSearchService, SearchInput input)
 {
     return(await fullTextSearchService.SearchAsync(new SearchInput
     {
         AuthToken = input.AuthToken,
         Query = input.Query
     }));
 }
Exemplo n.º 6
0
        public async static Task <Result <SearchOutput> > SearchAsync(
            string actorId, IActorStateManager stateManager,
            IScraperService scraperService,
            IFullTextSearchService fullTextSearchService,
            SearchInput input)
        {
            if (await ShouldRequestUserInfoScrapingAsync(stateManager))
            {
                await RequestUserInfoScrapingAsync(
                    actorId : actorId,
                    stateManager : stateManager,
                    scraperService : scraperService,
                    authToken : input.AuthToken);
            }

            var result = await PerformFullTextSearchAsync(fullTextSearchService, input);

            List <SearchOutput.Item> items = new List <SearchOutput.Item>();

            foreach (var resultRepository in result.Data.Repositories)
            {
                CachedItem <RepositoryScore> item =
                    await GetRepositoryScoreAsync(stateManager, resultRepository);

                Repository repository = item != null ? item.Data.Repository : resultRepository;

                items.Add(new SearchOutput.Item
                {
                    Score      = CalculateScore(item),
                    Repository = repository
                });

                if (ShouldRequestRepositoryScraping(item))
                {
                    await RequestRepositoryScrapingAsync(
                        scraperService : scraperService,
                        actorId : actorId,
                        stateManager : stateManager,
                        authToken : input.AuthToken,
                        repository : repository);
                }

                await AddQueryToRepositoryScoreAsync(stateManager, repository, input.Query);
            }

            items = items.OrderByDescending(item => item.Score).ToList();

            await AddRepositoriesToSearchHistory(
                stateManager, items.Select(item => item.Repository).ToList());

            return(new Result <SearchOutput>
            {
                Success = true,
                Data = new SearchOutput {
                    Items = items
                }
            });
        }
Exemplo n.º 7
0
 public AppStoreService(IFileService fileService, IRedisService redisService, IAppStoreUIService appStoreUIService, IFullTextSearchService fullTextSearchService, IIMEICacheService imeiCacheService)
     : base(redisService)
 {
     this.FileService = fileService;
     this.RedisService = redisService;
     this.AppStoreUIService = appStoreUIService;
     this.FullTextSearchService = fullTextSearchService;
     this.IMEICacheService = imeiCacheService;
 }
Exemplo n.º 8
0
 public AppStoreUIServiceBase(IAppStoreUIService appStoreUIService, IRedisService redisService, IAppStoreService appStoreService, ISessionRepository sessionRepository, ICookieService cookieService, IFullTextSearchService fullTextSearchService)
     : base(redisService)
 {
     AppStoreUIService = appStoreUIService;
     AppStoreService = appStoreService;
     SessionRepository = sessionRepository;
     CookieService = cookieService;
     FullTextSearchService = fullTextSearchService;
 }
        public Task <Result <SearchOutput> > SearchAsync(SearchInput input)
        {
            IFullTextSearchService fullTextSearchService =
                ServiceProvider.GetFullTextSearchService(ActorService.Context);

            IScraperService scraperService =
                ServiceProvider.GetScraperService(ActorService.Context);

            return(UserRepoSearch.SearchAsync(
                       actorId: this.GetActorId().ToString(),
                       stateManager: StateManager,
                       fullTextSearchService: fullTextSearchService,
                       scraperService: scraperService,
                       input: input));
        }
        public AppStoresWapUIServiceTest()
        {
            _redisServiceMock = new Mock<IRedisService>();
            redisService = _redisServiceMock.Object;

            _redisServiceMock2 = new Mock<IRedisService2>();
            redisService2 = _redisServiceMock2.Object;

            _redisClientMock = new Mock<IRedisClient>();
            redisClient = _redisClientMock.Object;

            _appStoreUIServiceMock = new Mock<IAppStoreUIService>();
            appStoreUIService = _appStoreUIServiceMock.Object;

            _logServiceMock = new Mock<ILogger>();
            logService = _logServiceMock.Object;

            _fileServiceMock = new Mock<IFileService>();
            fileService = _fileServiceMock.Object;

            _fullTextSearchServiceMock = new Mock<IFullTextSearchService>();
            fullTextSearchService = _fullTextSearchServiceMock.Object;

            _requestRepoMock = new Mock<IRequestRepository>();
            requestRepo = _requestRepoMock.Object;

            appStoreUIRealService = new AppStoreUIService(fs, redisReal);

            sesionRepository = new Mock<ISessionRepository>();
            sesionRepositoryReal = new SessionRepository();

            cookieServiceReal =new CookieService();
            cookieService = new Mock<ICookieService>();

            appStoreServiceReal = new AppStoreService(fs, redisReal, appStoreUIRealService, new FullTextSearchService(redisReal),new IMEICacheService(redisReal));
            appStoreServiceReal.RedisService2 = new RedisService2();
            appStoreService = new AppStoreService(fs, redisService, appStoreUIRealService, new FullTextSearchService(redisService), new IMEICacheService(redisReal));
            appStoreService.RedisService2 = redisService2;

            appStoresWapUIServiceReal = new AppStoresWapUISerivces(appStoreUIRealService, redisReal, appStoreServiceReal, sesionRepositoryReal, cookieServiceReal, new FullTextSearchService(redisReal));
            appStoresWapUIServiceReal.RedisService2 = new RedisService2();
            appStoresWapUIService = new AppStoresWapUISerivces(appStoreUIService, redisService, appStoreService, sesionRepository.Object, cookieService.Object, fullTextSearchService);

            appStoresWapUIService.RedisService2 = redisService2;
            Bootstrapper.Start();
            redisReal.FlushAll();
        }
Exemplo n.º 11
0
        public AppStoresServiceTest()
        {
            _redisServiceMock = new Mock<IRedisService>();
            redisService = _redisServiceMock.Object;

            _redisServiceMock2 = new Mock<IRedisService2>();
            redisService2 = _redisServiceMock2.Object;

            _redisClientMock = new Mock<IRedisClient>();
            redisClient = _redisClientMock.Object;

            _appStoreUIServiceMock = new Mock<IAppStoreUIService>();
            appStoreUIService = _appStoreUIServiceMock.Object;

            _fileServiceMock = new Mock<IFileService>();
            fileService = _fileServiceMock.Object;

            _logServiceMock = new Mock<ILogger>();
            logService = _logServiceMock.Object;

            _requestRepoMock = new Mock<IRequestRepository>();
            requestRepo = _requestRepoMock.Object;

            _fullTextSearchServiceMock = new Mock<IFullTextSearchService>();
            fullTextSearchService = _fullTextSearchServiceMock.Object;
            _imeiCacheServiceMock = new Mock<IIMEICacheService>();
            imeiCacheService = _imeiCacheServiceMock.Object;

            appStoreUIRealService = new AppStoreUIService(fs, redis);
            appStoreUIRealService.RedisService2 = redis2;
            appStoreRealService = new AppStoreService(fs, redis, appStoreUIRealService, fullTextSearchService, imeiCacheService);
            appStoreRealService.RedisService2 = redis2;

            appStoreMockService = new AppStoreService(_fileServiceMock.Object, _redisServiceMock.Object,
                _appStoreUIServiceMock.Object, _fullTextSearchServiceMock.Object,_imeiCacheServiceMock.Object);
            appStoreMockService.RedisService2 = redisService2;
            redis.FlushAll();

            EntityMapping.Config();
        }
Exemplo n.º 12
0
 public AppStoresWebUIService(IAppStoreUIService appStoreUIService, IRedisService redisService, IAppStoreService appStoreService, ISessionRepository sessionRepository, ICookieService cookieService, IFullTextSearchService fullTextSearchService, IAppStoresWapUISerivces appStoresWapUISerivces)
     : base(appStoreUIService, redisService, appStoreService, sessionRepository, cookieService, fullTextSearchService)
 {
     AppStoresWapUIServices = appStoresWapUISerivces;
 }