本文整理汇总了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);
}
}
}
}
示例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;
}