当前位置: 首页>>代码示例>>C#>>正文


C# org.getTopChildren方法代码示例

本文整理汇总了C#中org.getTopChildren方法的典型用法代码示例。如果您正苦于以下问题:C# org.getTopChildren方法的具体用法?C# org.getTopChildren怎么用?C# org.getTopChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org的用法示例。


在下文中一共展示了org.getTopChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildCategoryDetails

        private void BuildCategoryDetails(
            org.apache.lucene.facet.Facets facets, IList<CategoryDetail> categoryDetails, CategoryOptions categoryOptions, 
            string categoryName, string[] label, int count, IEnumerable<string> drillDownValues)
        {
            var lastLabel = label.Last();
            if (!drillDownValues.Contains(lastLabel))
            {
                categoryDetails.Add(new CategoryDetail { Value = lastLabel, Count = count });
//logger.Info("Value = {2} -- {0}; Count = {1}", lastLabel, count, String.Join("_ ", label));
            }
            else
            {
                var drilldownFacets = facets.getTopChildren(categoryOptions.MaxPerCategory, categoryName, label);
                if (drilldownFacets != null)
                {
                    var valDetail = new CategoryDetail { Value = lastLabel, Count = count };
                    categoryDetails.Add(valDetail);
                    foreach (var lv in drilldownFacets.labelValues)
                    {
                        var childLabel = new List<string>(label);
                        childLabel.Add(lv.label);
                        BuildCategoryDetails(
                            facets, valDetail.Children, categoryOptions, 
                            categoryName, childLabel.ToArray(), lv.value.intValue(), 
                            drillDownValues);
                    }
                }
            }
        }
开发者ID:kevintavog,项目名称:FindAPhoto-1.net,代码行数:29,代码来源:CategoriesSearcher.cs

示例2: RetrieveDrilldown

        private IList<Category> RetrieveDrilldown(org.apache.lucene.facet.Facets facets, CategoryOptions categoryOptions)
        {
            var results = new List<Category>();

            foreach (var name in categoryOptions.FacetNames)
            {
                if (Facets.IsHierarchical(name))
                {
                    var topCategory = new Category { Field = name, IsHierarchical = true };
                    results.Add(topCategory);

                    var directChildFacets = facets.getTopChildren(categoryOptions.MaxPerCategory, name);
                    if (directChildFacets != null)
                    {
                        IEnumerable<string> drillDownValues = categoryOptions.GetCategoryValues(name);
                        foreach (var labelValue in directChildFacets.labelValues)
                        {
                            var labelName = new string[] { labelValue.label };
                            BuildCategoryDetails(
                                facets, topCategory.Details, categoryOptions, 
                                name, labelName, labelValue.value.intValue(), 
                                drillDownValues);
                        }
                    }
                }
                else
                {
                    var fp = facets.getTopChildren(categoryOptions.MaxPerCategory, name);
                    if (fp != null)
                    {
                        var list = new List<CategoryDetail>(fp.labelValues.Length);
                        foreach (var lv in fp.labelValues)
                        {
                            list.Add(new CategoryDetail { Value = lv.label, Count = lv.value.intValue() });
                        }
                        results.Add(new Category { Field = name, Details = list });
                    }
                }
            }
            return results;
        }
开发者ID:kevintavog,项目名称:FindAPhoto-1.net,代码行数:41,代码来源:CategoriesSearcher.cs


注:本文中的org.getTopChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。