Thursday, May 7, 2015

Hide the category and the belonging products from search in websphere commerce

To block the particular category and belonging products from the search results,

1. We have to make the indexing field "ParentCatalogGroup" as facetable.Please run the following query to make the field as facetable

update facet set selection=1 where srchattr_id = (select srchattr_id from srchattr where identifier ='_cat.ParentCatalogGroup' and indextype='CatalogEntry');

2.Compose the filter query parameters to exclude the category and also sub categories in the format"-parentCatgroup_id_search:<catalogId>_<categoryId>".
(-)minus symbol before the parentCatgroup_id_search, which means exclude the category. (+) plus means include the category.

ex:-parentCatgroup_id_search:10001_10015

3.Then pass the query parameters as a facet into the expression builder.

For FEB-8


<wcf:rest var="catalogNavigationView1" url="${searchHostNamePath}${searchContextPath}/store/${WCParam.storeId}/productview/bySearchTerm/*">
            <wcf:param name="pageSize" value="${pageSize}" />
            <wcf:param name="pageNumber" value="${pageNumber + 1}" />
            <wcf:param name="profileName" value="${searchProfile}" />
            <wcf:param name="intentSearchTerm" value="${intentSearchTerm}" />
            <wcf:param name="searchType" value="${searchType}" />
            <wcf:param name="searchTerm" value="${searchTerm}" />
            <wcf:param name="searchSource" value="S" />
            <wcf:param name="originalSearchTerm" value="${originalSearchTerm}" />
            <wcf:param name="metaData" value="${WCParam.metaData}" />
        <%-- Default sort for CatEntListWidget --%>
            <c:choose>
                <c:when test="${not empty sortBy }" >
                    <wcf:param name="orderBy" value="${sortBy}" />
                </c:when>
                <c:otherwise>
                    <wcf:param name="orderBy" value="${WCParam.orderBy}" />
                </c:otherwise>
            </c:choose>
            <c:if test="${!empty WCParam.langId}">
                <wcf:param name="langId" value="${WCParam.langId}"/>
            </c:if>
            <c:if test="${empty WCParam.langId}">
                <wcf:param name="langId" value="${langId}"/>
            </c:if>
            <wcf:param name="currency" value="${env_currencyCode}"/>
            <wcf:param name="responseFormat" value="json"/>       
            <wcf:param name="catalogId" value="${WCParam.catalogId}"/>
            <c:forEach var="facetValue" items="${paramValues.facet}">
                <wcf:param name="facet" value="${facetValue}" />
            </c:forEach>
            <c:forEach var="facetLimit" items="${paramValues.facetLimit}">
                <wcf:param name="facetLimit" value="${facetLimit}" />
            </c:forEach>
           
            <c:forEach var="categoryGroup" items="-parentCatgroup_id_search:10001_10015,-parentCatgroup_id_search:10001_10020,-parentCatgroup_id_search:10001_10025">
                    <wcf:param name="facet" value="${categoryGroup}" />
            </c:forEach>

           
            <wcf:param name="advancedFacetList" value="${newAdvancedFacetList}"/>
            <wcf:param name="categoryId" value="${currentCategoryId}" />
            <wcf:param name="filterTerm" value="${newFilterTerm}" />
            <wcf:param name="filterType" value="${WCParam.filterType}" />
            <wcf:param name="filterFacet" value="${WCParam.filterFacet}" />
            <wcf:param name="manufacturer" value="${newManufacturer}" />
            <wcf:param name="minPrice" value="${WCParam.minPrice}" />
            <wcf:param name="maxPrice" value="${WCParam.maxPrice}" />
            <wcf:param name="physicalStoreIds" value="${cookieVal}" />
            <c:forEach var="contractId" items="${env_activeContractIds}">
                <wcf:param name="contractId" value="${contractId}"/>
            </c:forEach>
        </wcf:rest>

4.

No comments:

Post a Comment