public virtual ITopGroups <TGroupValue> GetTopGroups(int withinGroupOffset)
        {
            GroupDocs <TGroupValue>[] groupDocsResult = new GroupDocs <TGroupValue> [groups.Count()];

            int   groupIDX = 0;
            float maxScore = float.MinValue;

            foreach (var group in groups)
            {
                AbstractSecondPassGroupingCollector.SearchGroupDocs <TGroupValue> groupDocs = groupMap.ContainsKey(group.GroupValue) ? groupMap[group.GroupValue] : null;
                TopDocs topDocs = groupDocs.collector.TopDocs(withinGroupOffset, maxDocsPerGroup);
                groupDocsResult[groupIDX++] = new GroupDocs <TGroupValue>(float.NaN,
                                                                          topDocs.MaxScore,
                                                                          topDocs.TotalHits,
                                                                          topDocs.ScoreDocs,
                                                                          groupDocs.groupValue,
                                                                          group.SortValues);
                maxScore = Math.Max(maxScore, topDocs.MaxScore);
            }

            return(new TopGroups <TGroupValue>(groupSort.GetSort(),
                                               withinGroupSort == null ? null : withinGroupSort.GetSort(),
                                               totalHitCount, totalGroupedHitCount, groupDocsResult,
                                               maxScore));
        }
Exemplo n.º 2
0
        public virtual ITopGroups <TGroupValue> GetTopGroups(int withinGroupOffset)
        {
            GroupDocs <TGroupValue>[] groupDocsResult = new GroupDocs <TGroupValue> [groups.Count()];

            int   groupIDX = 0;
            float maxScore = float.Epsilon; // LUCENENET: Epsilon in .NET is the same as MIN_VALUE in Java

            foreach (var group in groups)
            {
                AbstractSecondPassGroupingCollector.SearchGroupDocs <TGroupValue> groupDocs = m_groupMap[group.GroupValue];
                TopDocs topDocs = groupDocs.Collector.GetTopDocs(withinGroupOffset, maxDocsPerGroup);
                groupDocsResult[groupIDX++] = new GroupDocs <TGroupValue>(float.NaN,
                                                                          topDocs.MaxScore,
                                                                          topDocs.TotalHits,
                                                                          topDocs.ScoreDocs,
                                                                          groupDocs.GroupValue,
                                                                          group.SortValues);
                maxScore = Math.Max(maxScore, topDocs.MaxScore);
            }

            return(new TopGroups <TGroupValue>(groupSort.GetSort(),
                                               withinGroupSort?.GetSort(),
                                               totalHitCount, totalGroupedHitCount, groupDocsResult,
                                               maxScore));
        }
 public override void Collect(int doc)
 {
     totalHitCount++;
     AbstractSecondPassGroupingCollector.SearchGroupDocs <TGroupValue> group = RetrieveGroup(doc);
     if (group != null)
     {
         totalGroupedHitCount++;
         group.collector.Collect(doc);
     }
 }