Sometime in Hybris interview we get question which
I heard first time so obviously unable to give answer of that
question
Yesterday i got question about solr boost So first we need understand what is Solr boost
> Suppose you using free text search on storefront in hybris means doing search something text like "123" then at hybris side solr query fire on solr server and display result on screen what he found in result so result will definitely happen on some index property of your Solr item type's index property like ean,code,name etc
Yesterday i got question about solr boost So first we need understand what is Solr boost
> Suppose you using free text search on storefront in hybris means doing search something text like "123" then at hybris side solr query fire on solr server and display result on screen what he found in result so result will definitely happen on some index property of your Solr item type's index property like ean,code,name etc
Let's suppose of text "123" match in all these 3 index property (ean,code,name) and you want display product (Ean match first) top on result so these type of
result we can achieve through solr boost where we boost the search result by providing high score (boost) to index property.
Before going to solr boost first another question is How can we add more index property in free text search in hybris
Technical
in hybris there one file name commerceservices-spring-solrfacetsearch.xml(hybris 5.5) where you can found defaultCommerceSearchTextPopulator where we need to add your index property to apply free text search
Before going to solr boost first another question is How can we add more index property in free text search in hybris
Technical
in hybris there one file name commerceservices-spring-solrfacetsearch.xml(hybris 5.5) where you can found defaultCommerceSearchTextPopulator where we need to add your index property to apply free text search
suppose there is index
property (description) on which you want
to apply free text search then you need to add this property as below
<alias
name="defaultCommerceSearchTextPopulator"
alias="commerceSearchTextPopulator"/>
<bean
id="defaultCommerceSearchTextPopulator" class="de.hybris.platform.commerceservices.search.solrfacetsearch.populators.SearchTextPopulator">
<property
name="freeTextQueryBuilders">
<list>
<bean class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="ean"/>
<property
name="boost" value="100"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="code"/>
<property
name="boost" value="90"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="name"/>
<property
name="boost" value="50"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="manufacturerName"/>
<property
name="boost" value="40"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.ClassificationFreeTextQueryBuilder">
<property name="boost"
value="30"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="keywords"/>
<property
name="boost" value="20"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="categoryName"/>
<property
name="boost" value="10"/>
</bean>
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="description"/>
<property
name="boost" value="10"/>
</bean>
</list>
</property>
</bean>
In above for every indexproperty there is given boost value
So in above boost value score the search
result means suppose you want to search text
"demo" and result is match in ean, name,
description and i want to see description result first then i will give higher boost value for description like below
<bean
class="de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.DefaultFreeTextQueryBuilder">
<property
name="propertyName" value="description"/>
<property name="boost"
value="110"/>
</bean>
So Finally, In interview if you
get question like suppose search text is match in more than
one index property but i want to see any specific
property result first then you can give answer of Solr boost
Solr boost can achieve
1. index-time boosts
2. Field Based Boosting
In hybris used Field Based Boosting - adding an optional query clause that
"boosts" documents for matching an "important: true" query,
Final Conclusion about Solr Boost : If we want to improve the sale of the product we can
boosting the product by some score. Based on the score the product will be
displayed on search. This is called solr boost. We can do this by HMC or Back
Office.
No comments:
Post a Comment