public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction) { BexisIndexer bexisIndexer = new BexisIndexer(); bexisIndexer.updateSingleDatasetIndex(datasetId, indAction); Reload(); }
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(); } }
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; }
// 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; }
public void UpdateSingleDatasetIndex(long datasetId, IndexingAction indAction) { throw new NotImplementedException(); }
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(); }
// Constructor // Supplying this with an IndexingAction behaviour is what makes this behave like an "Index" public IndexMC(SnapViewDirector svd, IndexingAction a) : base(svd, a) { }