public QueryPlanFull Build(QueryData data, ParsedQuery parsedQuery)
 {
     Maybe<QueryPlan> entityPlan = CreateEntityPlan(data, parsedQuery);
     Maybe<QueryPlan> commentPlan = CreateCommentPlan(data, parsedQuery);
     return new QueryPlanFull
         {
             Query = parsedQuery,
             EntityPlan = entityPlan,
             CommentPlan = commentPlan
         };
 }
예제 #2
0
        public QueryPlanFull Build(QueryData data, ParsedQuery parsedQuery)
        {
            Maybe <QueryPlan> entityPlan   = CreateEntityPlan(data, parsedQuery);
            Maybe <QueryPlan> testStepPlan = CreateTestStepPlan(data, parsedQuery);
            Maybe <QueryPlan> commentPlan  = CreateCommentPlan(data, parsedQuery);

            return(new QueryPlanFull
            {
                Query = parsedQuery,
                EntityPlan = entityPlan,
                TestStepPlan = testStepPlan,
                CommentPlan = commentPlan
            });
        }
 private Maybe<QueryPlan> CreateCommentPlan(QueryData data, ParsedQuery parsedQuery)
 {
     if (!data.ShouldSearchComment)
     {
         return Maybe.Nothing;
     }
     var contextPlan = _contextQueryPlanBuilder.Build(data, DocumentIndexTypeToken.CommentProject, DocumentIndexTypeToken.CommentSquad, DocumentIndexTypeToken.CommentEntityType);
     if (!contextPlan.HasValue)
     {
         return Maybe.Nothing;
     }
     var commentIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.Comment);
     var plan = commentIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized);
     return And(plan, contextPlan);
 }
		private Maybe<QueryPlan> CreateTestStepPlan(QueryData data, ParsedQuery parsedQuery)
		{
			if (!data.ShouldSearchTestStep)
			{
				return Maybe.Nothing;
			}
			var projectContextPlan = _contextQueryPlanBuilder.BuildProjectContextPlan(data.ProjectIds, data.IncludeNoProject, DocumentIndexTypeToken.TestStepProject);
			if (!projectContextPlan.HasValue)
			{
				return Maybe.Nothing;
			}
			var commentIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.TestStep);
			var plan = commentIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized);
			return And(plan, projectContextPlan);
		}
 private Maybe<QueryPlan> CreateEntityPlan(QueryData queryData, ParsedQuery parsedQuery)
 {
     if (queryData.IsCommentEntityType)
     {
         return Maybe.Nothing;
     }
     var contextPlan = _contextQueryPlanBuilder.Build(queryData, DocumentIndexTypeToken.EntityProject, DocumentIndexTypeToken.EntitySquad, DocumentIndexTypeToken.EntityType);
     if (!contextPlan.HasValue)
     {
         return Maybe.Nothing;
     }
     QueryPlan plan = CreateEntityQueryPlan(parsedQuery);
     plan = And(plan, CreateEntityTypePlan(queryData.EntityTypeId));
     plan = And(plan, CreateEntityStatePlan(queryData.EntityStateIds));
     plan = And(plan, contextPlan);
     return plan;
 }
        private Maybe <QueryPlan> CreateCommentPlan(QueryData data, ParsedQuery parsedQuery)
        {
            if (!data.ShouldSearchComment)
            {
                return(Maybe.Nothing);
            }
            var contextPlan = _contextQueryPlanBuilder.Build(data, DocumentIndexTypeToken.CommentProject, DocumentIndexTypeToken.CommentSquad, DocumentIndexTypeToken.CommentEntityType);

            if (!contextPlan.HasValue)
            {
                return(Maybe.Nothing);
            }
            var commentIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.Comment);
            var plan         = commentIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized);

            return(And(plan, contextPlan));
        }
예제 #7
0
        private Maybe <QueryPlan> CreateTestStepPlan(QueryData data, ParsedQuery parsedQuery)
        {
            if (!data.ShouldSearchTestStep)
            {
                return(Maybe.Nothing);
            }
            var projectContextPlan = _contextQueryPlanBuilder.BuildProjectContextPlan(data.ProjectIds, data.IncludeNoProject, DocumentIndexTypeToken.TestStepProject);

            if (!projectContextPlan.HasValue)
            {
                return(Maybe.Nothing);
            }
            var commentIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.TestStep);
            var plan         = commentIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized);

            return(And(plan, projectContextPlan));
        }
        private Maybe <QueryPlan> CreateEntityPlan(QueryData queryData, ParsedQuery parsedQuery)
        {
            if (queryData.IsCommentEntityType)
            {
                return(Maybe.Nothing);
            }
            var contextPlan = _contextQueryPlanBuilder.Build(queryData, DocumentIndexTypeToken.EntityProject, DocumentIndexTypeToken.EntitySquad, DocumentIndexTypeToken.EntityType);

            if (!contextPlan.HasValue)
            {
                return(Maybe.Nothing);
            }
            QueryPlan plan = CreateEntityQueryPlan(parsedQuery);

            plan = And(plan, CreateEntityTypePlan(queryData.EntityTypeId));
            plan = And(plan, CreateEntityStatePlan(queryData.EntityStateIds));
            plan = And(plan, contextPlan);
            return(plan);
        }
 private QueryPlan CreateEntityQueryPlan(ParsedQuery parsedQuery)
 {
     IDocumentIndex entityIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.Entity);
     return entityIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized);
 }
        private QueryPlan CreateEntityQueryPlan(ParsedQuery parsedQuery)
        {
            IDocumentIndex entityIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, DocumentIndexTypeToken.Entity);

            return(entityIndex.BuildExecutionPlan(parsedQuery, _profile.Initialized));
        }