<commit_before>﻿using SDL.ECommerce.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SDL.ECommerce.Api.Model;
using System.Text;

namespace SDL.ECommerce.DXA
{
    public class DXALinkResolver : IECommerceLinkResolver
    {
        public string GetAbsoluteFacetLink(IFacet facet, string navigationBasePath)
        {
            string link;
            if ( facet.IsCategory )
            {
                var category = ECommerceContext.Client.CategoryService.GetCategoryById(facet.Value);
                link = this.GetCategoryLink(category);
                link += this.GetFacetLink((IList<FacetParameter>)null);
            }
            else // facet
            {
                if ( facet.IsSelected )
                {
                    link = navigationBasePath + this.GetRemoveFacetLink(facet, null);
                }
                else
                {
                    link = navigationBasePath + this.GetAddFacetLink(facet, null);
                }
            }
            return link;
        }

        public string GetBreadcrumbLink(IBreadcrumb breadcrumb)
        {
            if (breadcrumb.IsCategory)
            {
                return ECommerceContext.Get(ECommerceContext.URL_PREFIX) + breadcrumb.CategoryRef.Path;
            }
            else
            {
                // Facet
                IList<FacetParameter> selectedFacets = (IList<FacetParameter>) ECommerceContext.Get(ECommerceContext.FACETS);
                return this.GetRemoveFacetLink(breadcrumb.Facet, selectedFacets);
            }<commit_msg>Corrected an issue with the GetAbsoluteFacetLink() on search pages.<commit_after>﻿using SDL.ECommerce.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SDL.ECommerce.Api.Model;
using System.Text;

namespace SDL.ECommerce.DXA
{
    public class DXALinkResolver : IECommerceLinkResolver
    {
        public string GetAbsoluteFacetLink(IFacet facet, string navigationBasePath)
        {
            string link;
            if ( facet.IsCategory )
            {
                var category = ECommerceContext.Client.CategoryService.GetCategoryById(facet.Value);
                link = this.GetNonContextualCategoryLink(category);
                link += this.GetFacetLink((IList<FacetParameter>)null);
            }
            else // facet
            {
                if ( facet.IsSelected )
                {
                    link = navigationBasePath + this.GetRemoveFacetLink(facet, null);
                }
                else
                {
                    link = navigationBasePath + this.GetAddFacetLink(facet, null);
                }
            }
            return link;
        }

        public string GetBreadcrumbLink(IBreadcrumb breadcrumb)
        {
            if (breadcrumb.IsCategory)
            {
                return ECommerceContext.Get(ECommerceContext.URL_PREFIX) + breadcrumb.CategoryRef.Path;
            }
            else
            {
                // Facet
                IList<FacetParameter> selectedFacets = (IList<FacetParameter>) ECommerceContext.Get(ECommerceContext.FACETS);
                return this.GetRemoveFacetLink(breadcrumb.Facet, selectedFacets);
            }
{'fraction_non_alphanumeric': 0.07645446238196771, 'fraction_numerical': 0.0, 'mean_word_length': 1.700657894736842, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6001475', 'n_tokens_mistral': 901, 'n_tokens_neox': 846, 'n_words': 148}