public DocumentIndexMemoryWatcher(IPluginContext pluginContext, IProfileReadonly profile, IDocumentIndexProvider documentIndexProvider, DocumentIndexSetup documentIndexSetup, IActivityLogger logger)
 {
     _pluginContext         = pluginContext;
     _profile               = profile;
     _documentIndexProvider = documentIndexProvider;
     _documentIndexSetup    = documentIndexSetup;
     _logger = logger;
 }
Exemplo n.º 2
0
        public IDocumentIndexOptimizeHint Create(DocumentIndexSetup setup)
        {
            switch (setup.DeferredOptimizeType)
            {
            case DeferredOptimizeType.None:
            case DeferredOptimizeType.Time:
                return(new DocumentIndexOptimizeNoHint());

            case DeferredOptimizeType.Calls:
                return(new DocumentIndexOptimizeByCallsHint(setup.DeferredOptimizeCounter));

            default:
                throw EnumServices.CreateUnexpectedEnumError(setup.DeferredOptimizeType);
            }
        }
 public QueryParser(DocumentIndexSetup setup)
 {
     _setup         = setup;
     _doubleQuotes  = new Regex("\"[^\"]+\"");
     _symbolRemover = new SpecialSymbolRemover();
     _steps         = new List <Func <ParserContext, ParserContext> >
     {
         RemoveNewLines,
         MakeToLowerCase,
         TransformDoubleQuotesPhraseToMandatoryWords,
         SplitBySpecialSymbolsThenRemoveThem,
         RemoveEmptyWords,
         RemoveNotIndexedString,
         TransformNonMandatoryWordsIntoCandidatesForContains,
         AddMandatoryWords,
         RemoveDuplicateWords,
     };
 }
Exemplo n.º 4
0
        public void RemovePreviousVersions()
        {
            var accountName             = AccountName.Empty;
            var documentIndexSetup      = new DocumentIndexSetup(string.Empty, 0, 0, 0);
            var activityLoggerFactory   = ObjectFactory.GetInstance <IActivityLoggerFactory>();
            var documentIndexOfVersion1 = CreateDocumentIndex(accountName, 1, documentIndexSetup, activityLoggerFactory);

            documentIndexOfVersion1.Shutdown(new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: false));
            var documentIndexOfVersion3 = CreateDocumentIndex(accountName, 3, documentIndexSetup, activityLoggerFactory);

            documentIndexOfVersion3.Shutdown(new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: false));
            var documentIndexOfVersion2 = CreateDocumentIndex(accountName, 2, documentIndexSetup, activityLoggerFactory);
            IEnumerable <int> versions  = documentIndexOfVersion2.Type.GetVersions(accountName, documentIndexSetup).ToList();

            versions.Should(Be.EquivalentTo(new[] { 1, 2, 3 }));
            foreach (var version in versions.Except(new[] { documentIndexOfVersion2.Type.Version }))
            {
                DocumentIndexType indexType = documentIndexOfVersion2.Type.CreateVersion(version);
                var documentIndex           = CreateDocumentIndex(accountName, indexType, documentIndexSetup, activityLoggerFactory);
                documentIndex.Shutdown(new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true));
            }
            documentIndexOfVersion2.Type.GetVersions(accountName, documentIndexSetup).Should(Be.EquivalentTo(new[] { documentIndexOfVersion2.Type.Version }));
            documentIndexOfVersion2.Shutdown(new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true));
        }
 public DocumentIndexOptimizer(IPluginContext pluginContext, IProfileReadonly profile, IDocumentIndexProvider documentIndexProvider, DocumentIndexSetup documentIndexSetup, DocumentIndexPeriodicOptimizeHintFactory optimizeHintFactory, IActivityLogger logger)
 {
     _pluginContext         = pluginContext;
     _profile               = profile;
     _documentIndexProvider = documentIndexProvider;
     _optimizeHint          = optimizeHintFactory.Create(documentIndexSetup);
     _logger = logger;
 }
Exemplo n.º 6
0
 private IDocumentIndex CreateDocumentIndex(AccountName accountName, DocumentIndexType documentIndexType, DocumentIndexSetup documentIndexSetup, IActivityLoggerFactory activityLoggerFactory)
 {
     return(new DocumentIndexTyped(documentIndexType, new PluginContextMock {
         AccountName = accountName, ProfileName = "Qq"
     }, () => { }, documentIndexSetup, activityLoggerFactory, new DocumentIndexOptimizeHintFactory()));
 }
Exemplo n.º 7
0
        private IDocumentIndex CreateDocumentIndex(AccountName accountName, int version, DocumentIndexSetup documentIndexSetup, IActivityLoggerFactory activityLoggerFactory)
        {
            var indexType = new DocumentIndexType(DocumentIndexTypeToken.Entity, DocumentIndexDataTypeToken.Digits, "Entity", Enumerable.Empty <Enum>(), Enumerable.Empty <Enum>(), version, new DigitsDocumentIndexDataTypeService(), new FileService());

            return(CreateDocumentIndex(accountName, indexType, documentIndexSetup, activityLoggerFactory));
        }