Ejemplo n.º 1
0
        public IHttpActionResult Dept()
        {
            try
            {
                IndexRepository dbData = new IndexRepository(dbCxt);
                IEnumerable <KeyValuePair <string, string> > queryString = Request.GetQueryNameValuePairs();

                string DeptValue = queryString.Where(nv => nv.Key == "dept_key").Select(nv => nv.Value).FirstOrDefault();
                //strip off last character if a slash

                //if pDeptKey is null then return all records

                if (String.IsNullOrEmpty(DeptValue))
                {
                    var dataValue = dbData.GetIndices();
                    return(Ok(dbData.GetIndices()));
                }
                int pDeptKey;

                Int32.TryParse(DeptValue, out pDeptKey);
                return(Ok(dbData.GetIndices_ByDept(pDeptKey)));
            }
            catch (Exception exError)
            {
                return(BadRequest((new Error(0, exError.Message, "IndicesByOwner").ToString())));
            }
        }
Ejemplo n.º 2
0
 public SearchManager(IndexRepository indexRepo, EngineVariablesRepository variablesRepo, PostsRepository postsRepo)
 {
     IndexRepo        = indexRepo;
     AverageDocLength = variablesRepo.GetEngineVariables().ContentAverageLength;
     CollectionSize   = postsRepo.GetCollectionSize();
     PostsRepo        = postsRepo;
 }
Ejemplo n.º 3
0
        public Search(PackTracker.History History)
        {
            this.InitializeComponent();

            this._index = new IndexRepository(History);
            this.txt_Search.Focus();
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     Destroy and clear resources.
 /// </summary>
 public void Destroy()
 {
     IndexRepository.Destroy();
     if (IsVirtualDataWindow) {
         VirtualDataWindow.HandleDestroy(AgentInstanceContext.AgentInstanceId);
     }
 }
Ejemplo n.º 5
0
        public IHttpActionResult IndicesOwnedByDept()
        {
            try
            {
                IndexRepository dbData = new IndexRepository(dbCxt);
                IEnumerable <KeyValuePair <string, string> > queryString = Request.GetQueryNameValuePairs();

                string pUniValue = queryString.Where(nv => nv.Key == "uni").Select(nv => nv.Value).FirstOrDefault();
                string DeptValue = queryString.Where(nv => nv.Key == "dept_key").Select(nv => nv.Value).FirstOrDefault();

                if ((pUniValue == null) || (DeptValue == null))
                {
                    return(NotFound());
                }

                int pDeptKey;
                if (!Int32.TryParse(DeptValue, out pDeptKey))
                {
                    // the try parse didn't work return an error code
                    return(BadRequest((new Error(1, "Could not parse dept key", "IndicesByOwner").ToString())));
                }
                // string orderby = queryString.Where(nv => nv.Key == "orderby").Select(nv => nv.Value).FirstOrDefault();
                return(Ok(dbData.GetIndicesOwned_ByDept(pUniValue, pDeptKey)));
            }
            catch (Exception exError)
            {
                return(BadRequest((new Error(0, exError.Message, "IndicesByOwner").ToString())));
            }
        }
        private Features.IndexStore.IIndexRepository SetupRepository(Network main, string dir)
        {
            var repository = new IndexRepository(main, dir, this.loggerFactory);

            repository.Initialize().GetAwaiter().GetResult();

            return(repository);
        }
 /// <summary>
 /// Create index in memory
 /// </summary>
 public static void CreateIndexInMemory()
 {
     //ExStart:CreateIndexInMemory
     // Create index in memory
     Index index1 = new Index();
     // Create index in memory using Index Repository
     IndexRepository repository = new IndexRepository();
     Index           index2     = repository.Create();
     //ExEnd:CreateIndexInMemory
 }
 /// <summary>
 /// Create index on disk
 /// </summary>
 public static void CreateIndexOnDisk()
 {
     //ExStart:CreateIndexOnDisk
     // Create index on disk
     Index index1 = new Index(Utilities.indexPath);
     // Create index on disk using Index Repository
     IndexRepository repository = new IndexRepository();
     Index           index2     = repository.Create(Utilities.indexPath2);
     //ExEnd:CreateIndexOnDisk
 }
        /// <summary>
        /// Create with overwriting existed index
        /// </summary>
        public static void CreateWithOverwritingExistedIndex()
        {
            //ExStart:CreateWithOverwritingExistedIndex
            // Create index on disk. If Index folder is not empty it will be rewited
            Index index1 = new Index(Utilities.indexPath, true);

            // Create index on disk using Index Repository
            IndexRepository repository = new IndexRepository();
            Index           index2     = repository.Create(Utilities.indexPath);
            //ExEnd:CreateWithOverwritingExistedIndex
        }
        /// <summary>
        /// Update index repository
        /// </summary>
        public static void UpdateIndexInRepository()
        {
            //ExStart:UpdateIndexInRepository
            IndexRepository repository = new IndexRepository();

            repository.AddToRepository(Utilities.indexPath);
            repository.AddToRepository(Utilities.indexPath2);
            // Update all indexes in repository
            repository.Update();
            //ExEnd:UpdateIndexInRepository
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Break Index Repository
        /// This method is supported by version 18.8 or greater
        /// </summary>
        public static void BreakIndexRepository()
        {
            string indexFolder     = Utilities.indexPath;
            string documentsFolder = Utilities.documentsPath;

            IndexRepository repository = new IndexRepository();
            Index           index      = repository.Create(indexFolder);

            index.AddToIndexAsync(documentsFolder);

            // Breaking all processes in all indexes in repository
            repository.Break();
        }
        /// <summary>
        /// Load index
        /// </summary>
        public static void LoadIndex()
        {
            //ExStart:loadindex
            // Load index
            Index index = new Index(Utilities.indexPath);

            // Load indexes to index repository
            IndexRepository repository = new IndexRepository();

            repository.AddToRepository(index);
            //repository.AddToRepository(Utilities.indexPath2);
            //ExEnd:loadindex
        }
Ejemplo n.º 13
0
        private Features.IndexStore.IIndexRepository SetupRepository(Network main, string dir = null)
        {
            if (dir == null)
            {
                dir = CreateTestDir(this);
            }

            var repository = new IndexRepository(main, dir, DateTimeProvider.Default, this.loggerFactory);

            repository.InitializeAsync().GetAwaiter().GetResult();

            return(repository);
        }
        /// <summary>
        /// Create index in memory with index settings
        /// </summary>
        public static void CreateIndexInMemoryWithIndexSettings()
        {
            //ExStart:CreateIndexInMemoryWithIndexSettings
            bool             quickIndexing = true;
            IndexingSettings settings      = new IndexingSettings(quickIndexing);

            // Create index on disk
            Index index1 = new Index(settings);

            // Create index on disk using Index Repository
            IndexRepository repository = new IndexRepository();
            Index           index2     = repository.Create(settings);
            //ExEnd:CreateIndexInMemoryWithIndexSettings
        }
        /// <summary>
        /// Update index in repository asynchronously
        /// </summary>
        public static void UpdateIndexInRepoAsynchronously()
        {
            //ExStart:UpdateIndexInRepoAsynchronously
            IndexRepository repository = new IndexRepository();

            repository.OperationFinished += Utilities.index_OperationFinished;

            repository.AddToRepository(Utilities.indexPath);
            repository.AddToRepository(Utilities.indexPath2);

            // Update all indexes in repository asynchronously
            repository.UpdateAsync();
            //ExEnd:UpdateIndexInRepoAsynchronously
        }
Ejemplo n.º 16
0
        public void IndexCommonStockInfo()
        {
            var client = new ElasticClient(new ConnectionSettings(new Uri("http://localhost:9200"))
                                           .DefaultIndex("theset"));
            var repo = new IndexRepository(client);

            try
            {
                repo.IndexData <CommonStockInfo>(_collection.FirstOrDefault(), "set", "commonstockinfo");
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
Ejemplo n.º 17
0
        public void Setup()
        {
            _transactionScope = new TransactionScope();

            _application1 = BuildMeA.Application("code1", "description1");
            _application2 = BuildMeA.Application("code2", "description2");

            _index1 = BuildMeA.Index("name", "indexColumn")
                      .WithApplication(_application1);

            _index2 = BuildMeA.Index("name2", "indexColumn2")
                      .WithApplication(_application2);

            _indexRepository = new IndexRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Break Index Repository using Cancellation Object
        /// This method is supported by version 18.8 or greater
        /// </summary>
        public static void BreakIndexRepositoryUsingCancellationObject()
        {
            string          documentsFolder = Utilities.documentsPath;
            IndexRepository repository      = new IndexRepository();
            Index           index           = repository.Create();

            index.AddToIndex(documentsFolder);

            Cancellation cnc = new Cancellation();

            // Updating all indexes in repository
            repository.UpdateAsync(cnc);

            // Canceling all operations in index repository
            cnc.Cancel();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Performs a search operation in several indexes using IndexRepository
        /// </summary>
        public static void SearchInSeveralIndexes()
        {
            // Creating Index Repository
            IndexRepository repository = new IndexRepository();

            // Adding already created indexes fo repository
            repository.AddToRepository(Utilities.booksIndex);
            repository.AddToRepository(Utilities.indexPath);
            repository.AddToRepository(Utilities.indexPath2);

            // Searching in all indexes in repository
            SearchResults searchResults = repository.Search("Gregor Samsa");

            // List of found files
            foreach (DocumentResultInfo result in searchResults)
            {
                Console.WriteLine((result.FileName));
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Merges current index with index repository asyncronously
        /// </summary>
        public static void MergingCurrentIndexWithIndexRepository()
        {
            //ExStart:MergingCurrentIndexWithIndexRepository
            IndexRepository indexRepository = new IndexRepository();
            Index           index1          = indexRepository.Create(Utilities.mergeIndexPath1);

            index1.AddToIndex(Utilities.documentsPath);

            Index index2 = indexRepository.Create(Utilities.mergeIndexPath2);

            index2.AddToIndex(Utilities.documentsPath2);

            Index mainIndex = new Index(Utilities.mainMergedIndexesPath);

            mainIndex.AddToIndex(Utilities.documentsPath3);

            // Merge data from indexes in repository to main index. After merge index repository stays unmodified.
            mainIndex.Merge(indexRepository);
            //ExEnd:MergingCurrentIndexWithIndexRepository
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Creates index in memory with index settings
        /// </summary>
        public static void CreateIndexInMemoryWithIndexSettings()
        {
            //ExStart:CreateIndexInMemoryWithIndexSettings

            //From version 17.9.0 quickIndexing has been marked obsolter and removed from the API
            //These 2 lines of code are no more valid from version 17.9.0 onward
            //bool quickIndexing = true;
            //IndexingSettings settings = new IndexingSettings(quickIndexing);


            IndexingSettings settings = new IndexingSettings();

            // Create index on disk
            Index index1 = new Index(settings);

            // Create index on disk using Index Repository
            IndexRepository repository = new IndexRepository();
            Index           index2     = repository.Create(settings);
            //ExEnd:CreateIndexInMemoryWithIndexSettings
        }
Ejemplo n.º 22
0
        public IHttpActionResult IndicesByOwner()
        {
            try
            {
                IndexRepository dbData = new IndexRepository(dbCxt);
                IEnumerable <KeyValuePair <string, string> > queryString = Request.GetQueryNameValuePairs();

                string pUniValue = queryString.Where(nv => nv.Key == "uni").Select(nv => nv.Value).FirstOrDefault();
                if (pUniValue == null)
                {
                    return(BadRequest((new Error(1, "Could not parse dept key", "IndicesByOwner").ToString())));
                }

                // string orderby = queryString.Where(nv => nv.Key == "orderby").Select(nv => nv.Value).FirstOrDefault();
                return(Ok(dbData.GetIndices_ByOwner(pUniValue)));
            }
            catch (Exception exError)
            {
                return(BadRequest((new Error(0, exError.Message, "IndicesByOwner").ToString())));
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 ///     Add an explicit index.
 /// </summary>
 /// <param name="explicitIndexDesc">index descriptor</param>
 /// <param name="explicitIndexModuleName">module name</param>
 /// <param name="isRecoveringResilient">indicator for recovering</param>
 /// <param name="explicitIndexName">index name</param>
 /// <throws>ExprValidationException if the index fails to be valid</throws>
 public void AddExplicitIndex(
     string explicitIndexName,
     string explicitIndexModuleName,
     QueryPlanIndexItem explicitIndexDesc,
     bool isRecoveringResilient)
 {
     lock (this) {
         var initIndex =
             AgentInstanceContext.StatementContext.EventTableIndexService.AllowInitIndex(isRecoveringResilient);
         var initializeFrom =
             initIndex ? DataWindowContents : CollectionUtil.NULL_EVENT_ITERABLE;
         IndexRepository.ValidateAddExplicitIndex(
             explicitIndexName,
             explicitIndexModuleName,
             explicitIndexDesc,
             rootView.EventType,
             initializeFrom,
             AgentInstanceContext,
             isRecoveringResilient,
             null);
     }
 }
 public BooleanSearchManager(IndexRepository indexRepo, EngineVariablesRepository variablesRepo, PostsRepository postsRepo) : base(indexRepo, variablesRepo, postsRepo)
 {
 }
Ejemplo n.º 25
0
        public static void Init(DatabaseInitMethod structureBootstrap,
                                IDbContext factory, IComponentContext ctx)
        {
            IndexRepository indexRepo = null;

            if (ctx.IsRegistered <IndexRepository>())
            {
                //cant take from context because IDbContext is initializing
                indexRepo = new IndexRepository(factory, log);
            }

            log.Info(String.Format("Initializing DB {0} {1} index module",
                                   structureBootstrap, (indexRepo == null?"without":"with")));

            switch (structureBootstrap)
            {
            case DatabaseInitMethod.DoNothing:
                if (indexRepo != null)
                {
                    indexRepo.IndexManagers.ForEach(x => x.Optimize());
                }
                break;

            case DatabaseInitMethod.Recreate:
                var schema = factory.GetSchemaExport();
                schema.Create(true, true);

                if (indexRepo != null)
                {
                    indexRepo.IndexManagers.ForEach(x => x.Fill());
                }

                break;

            case DatabaseInitMethod.FailIfInvalid:
                try
                {
                    factory.ValidateSchema();
                }
                catch (Exception ex)
                {
                    throw new Exception("FailIfInvalid valiadtion failed", ex);
                }
                Init(DatabaseInitMethod.DoNothing, factory, ctx);
                break;

            case DatabaseInitMethod.CreateIfInvalid:
                var newstructureBootstrapMethod = DatabaseInitMethod.DoNothing;
                //Test connection
                try
                {
                    factory.ValidateSchema();
                    if (indexRepo != null)
                    {
                        indexRepo.IndexManagers.ForEach(x => x.Purge());
                        indexRepo.IndexManagers.ForEach(x => x.Fill());
                    }
                }
                catch (Exception ex)
                {
                    log.Debug("CreateIfInvalid valiadtion failed");
                    log.Debug(ex);
                    newstructureBootstrapMethod = DatabaseInitMethod.Recreate;
                }
                Init(newstructureBootstrapMethod, factory, ctx);

                break;
            }
        }
Ejemplo n.º 26
0
        public static void Init(DatabaseInitMethod structureBootstrap, 
            IDbContext factory, IComponentContext ctx)
        {
            IndexRepository indexRepo = null;
            if (ctx.IsRegistered<IndexRepository>())
            {
                //cant take from context because IDbContext is initializing
                indexRepo = new IndexRepository(factory, log);
            }

            log.Info(String.Format("Initializing DB {0} {1} index module",
                structureBootstrap, (indexRepo==null?"without":"with")));

            switch (structureBootstrap)
            {
                case DatabaseInitMethod.DoNothing:
                    if(indexRepo!=null)
                    {
                        indexRepo.IndexManagers.ForEach(x => x.Optimize());
                    }
                    break;
                case DatabaseInitMethod.Recreate:
                    var schema = factory.GetSchemaExport();
                    schema.Create(true, true);

                    if (indexRepo != null)
                    {
                        indexRepo.IndexManagers.ForEach(x => x.Fill());
                    }
                   
                    break;
                case DatabaseInitMethod.FailIfInvalid:
                    try
                    {
                        factory.ValidateSchema();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("FailIfInvalid valiadtion failed", ex);
                    }
                    Init(DatabaseInitMethod.DoNothing, factory, ctx);
                    break;
                case DatabaseInitMethod.CreateIfInvalid:
                    var newstructureBootstrapMethod = DatabaseInitMethod.DoNothing;
                    //Test connection
                    try
                    {
                        factory.ValidateSchema();
                        if (indexRepo != null)
                        {
                            indexRepo.IndexManagers.ForEach(x => x.Purge());
                            indexRepo.IndexManagers.ForEach(x => x.Fill());
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Debug("CreateIfInvalid valiadtion failed");
                        log.Debug(ex);
                        newstructureBootstrapMethod = DatabaseInitMethod.Recreate;
                    }
                    Init(newstructureBootstrapMethod, factory, ctx);

                    break;
            }
        }
Ejemplo n.º 27
0
 public HomeController()
 {
     this.repository = new IndexRepository();
 }
Ejemplo n.º 28
0
 public ProximityProbabilisticModelSearchManager(IndexRepository indexRepo, EngineVariablesRepository variablesRepo, PostsRepository postsRepo) : base(indexRepo, variablesRepo, postsRepo)
 {
 }
Ejemplo n.º 29
0
 public FrequencySearchManager(IndexRepository indexRepo, EngineVariablesRepository variablesRepo, PostsRepository postsRepo) : base(indexRepo, variablesRepo, postsRepo)
 {
 }
Ejemplo n.º 30
0
 public override void AddExplicitIndex(CreateIndexDesc spec)
 {
     IndexRepository.ValidateAddExplicitIndex(spec.IsUnique, spec.IndexName, spec.Columns, TableMetadata.InternalEventType, new PrimaryIndexIterable(_rows));
 }