public virtual FacetIterator GetIterator() { IDictionary <string, string> props = m_sel == null ? null : m_sel.SelectionProperties; int depth = PathFacetHandler.GetDepth(props); bool strict = PathFacetHandler.IsStrict(props); List <BrowseFacet> finalList; string[] paths = m_sel == null ? null : m_sel.Values; if (paths == null || paths.Length == 0) { finalList = new List <BrowseFacet>(GetFacetsForPath(null, depth, strict, int.MinValue, m_count.Length)); return(new PathFacetIterator(finalList)); } if (paths.Length == 1) { finalList = new List <BrowseFacet>(GetFacetsForPath(paths[0], depth, strict, int.MinValue, m_count.Length)); return(new PathFacetIterator(finalList)); } finalList = new List <BrowseFacet>(); var iterList = new List <IEnumerator <BrowseFacet> >(paths.Length); foreach (string path in paths) { var subList = GetFacetsForPath(path, depth, strict, int.MinValue, m_count.Length); if (subList.Count > 0) { iterList.Add(subList.GetEnumerator()); } } var finalIter = ListMerger.MergeLists(iterList.ToArray(), m_comparerFactory == null ? new FacetValueComparerFactory().NewComparer() : m_comparerFactory.NewComparer()); while (finalIter.MoveNext()) { BrowseFacet f = finalIter.Current; finalList.Add(f); } return(new PathFacetIterator(finalList)); }
public virtual IEnumerable <BrowseFacet> GetFacets() { IDictionary <string, string> props = _sel == null ? null : _sel.SelectionProperties; int depth = PathFacetHandler.GetDepth(props); bool strict = PathFacetHandler.IsStrict(props); string[] paths = _sel == null ? null : _sel.Values; if (paths == null || paths.Length == 0) { return(GetFacetsForPath(null, depth, strict, _minHitCount, _maxCount)); } if (paths.Length == 1) { return(GetFacetsForPath(paths[0], depth, strict, _minHitCount, _maxCount)); } List <BrowseFacet> finalList = new List <BrowseFacet>(); var iterList = new List <IEnumerator <BrowseFacet> >(paths.Length); foreach (string path in paths) { var subList = GetFacetsForPath(path, depth, strict, _minHitCount, _maxCount); if (subList.Count() > 0) { iterList.Add(subList.GetEnumerator()); } } var finalIter = ListMerger.MergeLists(iterList.ToArray(), _comparatorFactory == null ? new FacetValueComparatorFactory().NewComparator() : _comparatorFactory.NewComparator()); while (finalIter.MoveNext()) { BrowseFacet f = finalIter.Current; finalList.Insert(0, f); } return(finalList); }