Thursday, November 13, 2014

Debugging Solr Search Sort Issue on Department(Category) pages

It loads the page Layouts/CategoryNavigationResults.jsp and when selecting different sort options
When debugging the Ajax call in the Net tab, you will see the orderBy value corresponding to the values defined in the search profile.
http://localhost/CategoryNavigationResultsView?searchType=&filterCollQuery=&langId=-1&beginIndex=0&sType=SimpleSearch&metaData=&pageSize=48&manufacturer=&resultCatEntryType=&catalogId=10051&productBeginIndex=0&categoryId=13632&storeId=10151&filterFacet=
beginIndex=0
catalogId=10051
contentBeginIndex=0
facet=
isHistory=false
langId=
maxPrice=
minPrice=
objectId=
orderBy=6
orderByContent=
pageSize=0
pageView=grid
productBeginIndex=0
requesttype=ajax
resultType=products
searchTerm=
storeId=10151
Enable Trace:
*=info: com.ibm.commerce.catalog.*=all: com.ibm.commerce.foundation.*=all: com.ibm.commerce.search.*=all

Search in trace.log: Find searchProfile=[IBM_ in logs
e.g: found
searchProfile=[IBM_ComposeFacetListByCategoryId]
schema.xml  : Make sure the entries are correctly available in the schema file
      <field name="abcRanking" type="tfloat" indexed="true" stored="false" multiValued="false" />
 <field name="abcRanking_display" type="float" indexed="true" stored="true" multiValued="false" />


Do not make any customization's to the FEP for this file and this would have performance impact and would cause multiple issues in future upgrades.
There are targetable versions for each environment wc-search.xml, make sure
Find the corresponding search profile in extended wc-search.xml
 <_config:profile indexName="CatalogEntry" name="IBM_ComposeProductListByCategoryId">


Check for the attribute value in the database by running in DB
select av.value,cat.partnumber,cat.catentry_id from attrvaldesc av, catentryattr cattr, attr a, catentry cat where
av.attrval_id = cattr.attrval_id
and cattr.attr_id = a.attr_id
and cattr.catentry_id =cat.catentry_id
and a.identifier='abcAttribute' order by value desc

Make sure the attribute is searchable:

Check for the Attribute in the following tables:

It is possible that attrdictsrchconf .SRCHFIELDNAME is mapped to a different name than the actual attribute name in

select * from attrdictsrchconf where attr_id in (select attr_id from attr where identifier in ('abcAttribute'))

select * from srchattr where identifier like '%abcAttribute';

C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.catalog-fep\wc-search.xml
C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.catalog-ext\wc-search.xml

    <_config:profile indexName="CatalogEntry" name="IBM_ComposeProductListByCategoryId">
        <_config:query>
            <_config:param name="maxRows" value="50"/>
            <_config:param name="maxTimeAllowed" value="15000"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByCategoryExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByManufacturerExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByPriceExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByFacetExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByStorePathExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByPublishedEntryOnlyExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchByCustomExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchFacetConditionExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchTypeExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchSequencingExpressionProvider"/>
            <_config:provider classname="com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchProductEntitlementExpressionProvider"/>
            <_config:field name="name"/>
        </_config:query>
        <_config:sort>
            <_config:field name="1" value="mfName_ntk asc"/>
            <_config:field name="2" value="name_ntk asc"/>
            <_config:field name="3" value="price_* asc"/>
            <_config:field name="4" value="price_* desc"/>
            <_config:field name="5" value="quantitySold desc"/>
            <_config:field name="6" value="abcRanking desc" />
            <_config:field name="7" value="totalPriceSold desc"/>
        </_config:sort>
        <_config:result>
            <_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogEntryViewPriceResultFilter"/>
            <!--
            <_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogEntryViewSingleSKUResultFilter"/>
            -->
            <_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogNavigationViewPreviewResultFilter"/>
            <_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogNavigationViewDynamicKitResultFilter"/>
            <_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogEntryViewDescriptionResultFilter"/>
            <_config:filter classname="com.custom.commerce.search.query.solr.SolrFacetEntryViewImageAndSequenceResultFilter"/>
        </_config:result>
        <_config:facets>
            <_config:param name="sort" value="count"/>
            <_config:param name="minCount" value="1"/>
            <_config:param name="limit" value="200"/>        
        </_config:facets>
    </_config:profile>

No comments:

Post a Comment