on 2018 Sep 02 9:29 PM
Hello,
In the store front search box I can enter tes*
How do I configure the wild cards in solr for search criteria so that it will return the results properly.
Thanks in advance.
Request clarification before answering.
Hey
Firstly, I kindly suggest you get familiar with Solr Search Features on this page: https://wiki.hybris.com/display/hybrisALF/Solr+Search+Features
There are mainly 4 settings that you can configure in the Solr query:
Field - which corresponds to a indexed type*
Boost – which is the amount of relevancy for the field*
Wildcard - When you want to use variations of words and phrases
Term Proximity – which is the moving terms position of the n spaces combined
(*) On the OOTB configuration.
The fields and the boost can be easily configured on the SearchTextPopulator. The SearchTextPopulator is defined in the commerceservice-spring-solrfacetsearch.xml file in commerceservices extension, under resources folder. Each property name corresponds to a field and their boost.
In order to configure the Wildcard or the Term Proximity or other settings you have to follow the next steps: 1. Create your own customFreeTextQueryBuilder extending from DefaultFreeTextQueryBuilder. 2. Override the addFreeTextQuery method with your logic. Take a look at de.hybris.platform.commerceservices.search.solrfacetsearch.querybuilder.impl.AbstractFreeTextQueryBuilder file as a guide. 3. Add the commerceservices as a required extension in your extension’s extensioninfo.xml file. 4. Define the new bean in your extension in your extension’s yourextension-spring.xm*l file so that it overrides the initially used DefaultFreeTextQueryBuilder. Here’s the example:
<alias name=“customCommerceSearchTextPopulator" alias="commerceSearchTextPopulator" />
<bean id="customCommerceSearchTextPopulator" class="de.hybris.platform.commerceservices.search.solrfacetsearch.populators.SearchTextPopulator">
<property name="freeTextQueryBuilders">
<list>
<bean class="org.training.querybuilder.CustomFreeTextQueryBuilder">
<property name="propertyName" value="ean" />
<property name="boost" value="100" />
</bean>
<bean class="org.training.querybuilder.CustomFreeTextQueryBuilder">
<property name="propertyName" value="code" />
<property name="boost" value="90" />
</bean>
...
Alternatively you can also make some changes using back office. Go to Backoffice -> System -> Facet search -> Facet Search Config.
Hope that helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
in the backoffice -> system -> facet search -> indexed types, you should find a list of (indexable) attributes for each type. For example you´ll have a product, with an attribute "name" that should be relevant for solr search. For this attribute you can "Edit Details" which will lead you to a lot of search options, including a minimum input length to trigger the search, fuzzy search options, and wildcard search settings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.