private Category GetRootCategory(int publicationId) { var publicationConfiguration = this.GetPublicationConfiguration(publicationId); String cacheKey = publicationConfiguration.Universe + ":" + publicationConfiguration.Locale; Category rootCategory; this.rootCategories.TryGetValue(cacheKey, out rootCategory); if (rootCategory == null) { rootCategory = new FredhopperCategory(null, null, null); this.rootCategories.Add(cacheKey, rootCategory); this.GetCategoryTree(rootCategory, 0, this.categoryMaxDepth - 1, publicationId); } return(rootCategory); }
private void GetCategories(Category parentCategory, int publicationId) { Location location; if (parentCategory != null && parentCategory.CategoryId != null) { location = GetLocation(publicationId, parentCategory.CategoryId); } else { location = GetLocation(publicationId); } Query query = new Query(location); page fhPage = this.fhClient.getAll(query.toString()); universe universe = this.GetUniverse(fhPage); var facetmap = universe.facetmap[0]; var filters = facetmap.filter; foreach (var filter in filters) { if (filter.basetype == attributeTypeFormat.cat) { foreach (var section in filter.filtersection) { if (parentCategory == null || !CategoryAlreadyExistInStructure(parentCategory, section.value.Value)) { var category = new FredhopperCategory(section.value.Value, section.link.name, parentCategory); if (parentCategory != null) { parentCategory.Categories.Add(category); } } } } } }