Esempio n. 1
0
        public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction)
        {
            BexisIndexer bexisIndexer = new BexisIndexer();

            bexisIndexer.updateSingleDatasetIndex(datasetId, indAction);

            Reload();
        }
Esempio n. 2
0
        public void updateSingleDatasetIndex(long datasetId, IndexingAction indAction)
        {
            try
            {
                if (!isIndexConfigured)
                {
                    this.configureBexisIndexing(false);
                }
                DatasetManager dm = new DatasetManager();
                if (indAction == IndexingAction.CREATE)
                {
                    Query   query = new TermQuery(new Term("doc_id", datasetId.ToString()));
                    TopDocs tds   = BexisIndexSearcher.getIndexSearcher().Search(query, 1);

                    this.includePrimaryData = false;

                    if (tds.TotalHits < 1)
                    {
                        writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId));
                    }
                    else
                    {
                        indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                        autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
                        writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId));
                    }
                }
                else if (indAction == IndexingAction.DELETE)
                {
                    indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                    autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
                }
                else if (indAction == IndexingAction.UPDATE)
                {
                    indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                    autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
                    writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId));
                }

                indexWriter.Commit();
                autoCompleteIndexWriter.Commit();
                BexisIndexSearcher.searcher             = new IndexSearcher(indexWriter.GetReader());
                BexisIndexSearcher._Reader              = indexWriter.GetReader();
                BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                BexisIndexSearcher.searcher             = new IndexSearcher(indexWriter.GetReader());
                BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader());

                indexWriter.Dispose();
                autoCompleteIndexWriter.Dispose();
            }
        }
Esempio n. 3
0
        public IndexingTask(
            IndexingAction action,
            FileEntry <Metadata> fileEntry,
            CancellationToken queueCancellationToken)
        {
            Action    = action;
            FileEntry = fileEntry;

            _taskCancellationSource = new CancellationTokenSource();

            _combinedCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(
                _taskCancellationSource.Token,
                queueCancellationToken);

            _creationTime = DateTime.UtcNow;
        }
Esempio n. 4
0
        // Search for a valid index with the supplied field_name. If can't find, return null.
        public List<string> get_index(string idx_field_name)
        {
            List<string> rtn_idx = null;

            // Look for an IndexMC with a Field name matching idx_field_name.
            foreach (MediatorColleague mc in mcList)
            {
                if (mc is MCAction)
                {
                    MCAction mca = (MCAction)mc;
                    // Three parts to the condition: field name must match, must be an Index, and it must be valid
                    if (mca.get_action().field.name == idx_field_name && mca.get_action() is IndexingAction && mca.isValid == true)
                    {
                        IndexingAction ia = (IndexingAction)mca.get_action();
                        rtn_idx = ia.getStrLst();
                    }
                }
            }

            return rtn_idx;
        }
Esempio n. 5
0
 public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
        public void updateSingleDatasetIndex(long datasetId, IndexingAction indAction)
        {
            if (!isIndexConfigured)
            {
                this.configureBexisIndexing(false);
            }
            DatasetManager dm = new DatasetManager();
            if (indAction == IndexingAction.CREATE)
            {
                Query query = new TermQuery(new Term("doc_id", datasetId.ToString()));
                TopDocs tds = BexisIndexSearcher.getIndexSearcher().Search(query, 1);

                if (tds.TotalHits < 1) { writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId)); }
                else {
                    indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                    autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
                    writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId));
                }
            }
            else if (indAction == IndexingAction.DELETE)
            {
                indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
            }
            else if (indAction == IndexingAction.UPDATE)
            {
                indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString()));
                autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString()));
                writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId));
            }

            indexWriter.Commit();
            autoCompleteIndexWriter.Commit();
            BexisIndexSearcher.searcher = new IndexSearcher(indexWriter.GetReader());
            BexisIndexSearcher._Reader = indexWriter.GetReader();
            BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader());
            indexWriter.Dispose();
            autoCompleteIndexWriter.Dispose();
        }
Esempio n. 8
0
        public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction)
        {
            BexisIndexer bexisIndexer = new BexisIndexer();
            bexisIndexer.updateSingleDatasetIndex(datasetId, indAction);

            Reload();
        }
Esempio n. 9
0
 // Constructor
 // Supplying this with an IndexingAction behaviour is what makes this behave like an "Index"
 public IndexMC(SnapViewDirector svd, IndexingAction a)
     : base(svd, a)
 {
 }