public static SquadIndexData Substract(SquadIndexData left, SquadIndexData right) { var ids = IdsIndexData.Substract(left, right).ToList(); // Add no team when ids collention doesn't contains any real team if (ids.Count == 0) { ids.Add(NoTeamId); } return new SquadIndexData(ids); }
public static SquadIndexData Sum(SquadIndexData left, SquadIndexData right) { var ids = IdsIndexData.Sum(left, right).ToList(); // Exlude no team from teams collection if it contains any team if (ids.Count > 1 && ids.Contains(NoTeamId)) { ids = ids.Except(new[] {NoTeamId}).ToList(); } return new SquadIndexData(ids); }
private Maybe<QueryPlan> BuildSquadPlan(IEnumerable<int> squadIds, bool includeNoTeam, DocumentIndexTypeToken squadContextType) { var squadIdsIndexData = squadIds != null ? squadIds.Cast<int?>().ToArray() : new int?[0]; var nullSquadIndexData = includeNoTeam ? new int?[] {null} : new int?[0]; var squadIndexData = new SquadIndexData(squadIdsIndexData.Concat(nullSquadIndexData).Distinct()); var query = squadIndexData.ToString(); if (string.IsNullOrEmpty(query)) { return Maybe.Nothing; } var squadIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, squadContextType); return squadIndex.BuildExecutionPlan(new ParsedQuery(words: query), _profile.Initialized); }