コード例 #1
0
		private QueryResultData CreateQueryResultData(QueryResult result)
		{
			return new QueryResultData
				{
					GeneralIds = result.GeneralIds.ToArray(),
					AssignableIds = result.AssignableIds.ToArray(),
					TestCaseIds = result.TestCaseIds.ToArray(),
					CommentIds = result.CommentIds,
					QueryString = result.QueryString,
					Total = result.Total,
					IndexProgressData = CreateIndexingProgress(result)
				};
		}
コード例 #2
0
		private QueryResult CreateResult(QueryRunResult queryResult, QueryData queryData)
		{
			QueryEntityTypeProvider.SearchResult result = _queryResultFactory.CreateQueryResult(queryResult.Entities);
			var searchResult = new QueryResult
				{
					GeneralIds = result.GeneralIds.ToArray(),
					AssignableIds = result.AssignableIds.ToArray(),
					TestCaseIds = result.TestCaseIds.ToArray(),
					CommentIds = queryResult.Comments.Select(i => i.FileName).ToArray(),
					QueryString = queryData.Query,
					Total = queryResult.EntitiesTotalCount + queryResult.CommentsTotalCount,
					LastIndexedEntityId = queryResult.LastIndexedEntityId,
					LastIndexedCommentId = queryResult.LastIndexedCommentId
				};
			return searchResult;
		}
コード例 #3
0
		private IndexProgressData CreateIndexingProgress(QueryResult result)
		{
			if (_profile.Initialized)
			{
				return new IndexProgressData
				{
					CompleteInPercents = 100
				};
			}
			IStorage<IndexProgress> indexProgressStorage = _profile.Get<IndexProgress>(typeof (IndexProgress).Name);
			IndexProgress indexProgress = indexProgressStorage.FirstOrDefault();
			if (indexProgress == null)
			{
				return new IndexProgressData
					{
						CompleteInPercents = 0
					};
			}
			int allEntities = indexProgress.LastGeneralId + indexProgress.LastCommentId;
			double completeInPercents = allEntities != 0 ? (double)((result.LastIndexedEntityId + result.LastIndexedCommentId)*100)/allEntities : 0;
			return new IndexProgressData { CompleteInPercents = Math.Round(completeInPercents, 2) };
		}