public SnapshotContract GetLatestPublishedSnapshot(long projectId) { var latestSnapshot = m_snapshotRepository.InvokeUnitOfWork(x => x.GetLatestPublishedSnapshot(projectId)); var snapshotContract = m_mapper.Map <SnapshotContract>(latestSnapshot); return(snapshotContract); }
public List <CorpusSearchResultContract> SearchCorpusInSnapshotByCriteria(long snapshotId, BookPagedCorpusSearchInSnapshotRequestContract request) { m_authorizationManager.AuthorizeSnapshot(snapshotId); var processedCriterias = GetAuthorizatedProcessedCriterias(request.ConditionConjunction); var nonMetadataCriterias = processedCriterias.NonMetadataCriterias; // Search in fulltext DB var snapshotInfo = m_snapshotRepository.InvokeUnitOfWork(x => x.GetSnapshot(snapshotId)); var fulltextStorage = m_fulltextStorageProvider.GetFulltextStorage(snapshotInfo.Project.ProjectType); var start = m_corpusSearchManager.GetCorpusStart(request.Start); var count = m_corpusSearchManager.GetCorpusCount(request.Count); var contextLength = m_corpusSearchManager.GetContextLength(request.ContextLength); var result = fulltextStorage.SearchCorpusInSnapshotByCriteria(snapshotId, start, count, contextLength, nonMetadataCriterias); switch (result.SearchResultType) { case FulltextSearchResultType.ProjectId: return(m_corpusSearchManager.GetCorpusSearchResultByStandardIds(result.List)); case FulltextSearchResultType.ProjectExternalId: return(m_corpusSearchManager.GetCorpusSearchResultByExternalIds(result.List, snapshotInfo.Project.ProjectType)); default: throw new ArgumentOutOfRangeException(); } }