public IEnumerable <DocumentScore> Reduce() { var first = Scored; if (_queries != null) { foreach (var child in _queries) { var other = child.Reduce(); if (child.And) { first = DocumentScore.CombineAnd(first, other).ToList(); } else if (child.Not) { first = DocumentScore.Not(first, other).ToList(); } else // Or { first = DocumentScore.CombineOr(first, other).ToList(); } } } return(first); }
public static IList <DocumentScore> Reduce(this IList <QueryContext> query) { var first = query[0].Scores; for (int i = 1; i < query.Count; i++) { var term = query[i]; var other = term.Scores; if (term.Query.Or) { first = DocumentScore.CombineOr(first, other); } else if (term.Query.Not) { first = DocumentScore.Not(first, other); } else // And { first = DocumentScore.CombineAnd(first, other); } } return(first); }