Search This Blog

Thursday, March 7, 2013

Search formula in wc-component.xml


There is one config property in wc-component.xml to define any search formula. Out of the box formula drives product sequencing based on sequence defined in catgpenrel table (Through management center)


<!-- Formula for boosting by product/category sequence: -0.001 x rank -->
<_config:property name="BoostByRankInCatalogAndCategory" value="sum(mfvalue,soldquantity,actualqtysold,getSequenceByCatalogAndCategory(sequence,%s,%s))" />

Somehow there is not enough documentation around this. So here is outcome of my analysis

This above formula is nothing more than a SolrFunctionQuery..

http://wiki.apache.org/solr/FunctionQuery

You can use any solr funcation query in this formula.

Out of the box formula use a method getSequenceByCatalogAndCategory(sequence,%s,%s).

This method is a solr value source parser as defined in solrconfig.xml


<valueSourceParser name="getSequenceByCatalogAndCategory" class="com.ibm.commerce.foundation.internal.server.services.search.function.solr.SolrSearchGetSequenceByCatalogAndCategoryFunctionParser" />

You can create any custom value source parser and use with WCS to influence search results.

A small article on solr value source parser

http://www.supermind.org/blog/756/how-to-write-a-custom-solr-functionquery

Out of the box value source parser implementation is available in solr.war

in development environment you can find at following location

<WC INSTALL DIR>\components\foundation\wc.ear.ext\Solr.war\WEB-INF\classes\com\ibm\commerce\foundation\internal\server\services\search\function\solr



3 comments: