Thursday, March 10, 2016

How to Prevent to display unnecessary Endeca query parameters in URL?

Most of the time record filters, range filters are used as part of creating navigation request and fire a query to Endeca using cartridge ... thumbnail 1 summary

Most of the time record filters, range filters are used as part of creating navigation request and fire a query to Endeca using cartridge handler. Endeca returns navigation object that contains record, dimensions and descriptors. Endeca provides Basic and SEO URL formatted to format Endeca URL. Most of the clients use SEOUrlFormatter for live application.

Behavior : - 

Endeca returns all appended parameters as well, that got added in navigation state builder, part of  Guided navigation and breadcrumb URLs. Nr parameter starts visible in refinement menu URL.

Example :- /electronics/computers-tablets/computer-accessories/_/N-abcd?Nr=sku.inStock%3A1&Ns=product.startDate%7C1

Solution : -

Extend SeoUrlFormatter and override checkIgnoredParamList method. so that ignored parameter would not be sent over to front-end.

Sample Code below:-

public boolean checkIgnoredParamList(UrlParam urlParam) {
if ("Nf".equalsIgnoreCase(urlParam.getKey()) || "Nr".equalsIgnoreCase(urlParam.getKey()) || "_dyncharset".equalsIgnoreCase(urlParam.getKey())
|| "_D:siteScope".equalsIgnoreCase(urlParam.getKey()) || "siteScope".equalsIgnoreCase(urlParam.getKey()) || "_D:siteIds".equalsIgnoreCase(urlParam.getKey()) || "search".equalsIgnoreCase(urlParam.getKey())
|| "_DARGS".equalsIgnoreCase(urlParam.getKey())) {
return true;
}

return false;

}

Note: Any customization to SeoUrlFormmater needs to add into SEO URL generator classpath.



Click here to view How to Enable URL canonicalization


From Author

Was this post resolve the SEO issue?Provide your comments 

1 comment

  1. Hi Ajay,

    I am working with the latest version 11.2, but didn't got any method with name "checkIgnoredParamList" in the codebase. Please clarify more.

    Thanks,
    Swap

    ReplyDelete

Text Widget