public void ProjectDataSumTest() { var left = new ProjectIndexData(new int?[] { 1, 2 }); var right = new ProjectIndexData(new int?[] { 1, 2, 3 }); var result = ProjectIndexData.Sum(left, right); result.ProjectIds.Should(Be.EquivalentTo(new[] { 1, 2, 3 })); }
public Maybe <QueryPlan> BuildProjectContextPlan(IEnumerable <int> projectIds, bool includeNoProject, DocumentIndexTypeToken projectIndexTypeToken) { ProjectIndexData projectIdsIndexData = projectIds != null ? new ProjectIndexData(projectIds.Cast <int?>().ToList()) : ProjectIndexData.Empty; ProjectIndexData nullProjectIndexData = includeNoProject ? new ProjectIndexData(new int?[] { null }) : ProjectIndexData.Empty; var result = ProjectIndexData.Sum(projectIdsIndexData, nullProjectIndexData); string query = result.ToString(); if (string.IsNullOrEmpty(query)) { return(Maybe.Nothing); } IDocumentIndex projectContextIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, projectIndexTypeToken); return(projectContextIndex.BuildExecutionPlan(new ParsedQuery(words: query), _profile.Initialized)); }