cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modify backoffice text search to add attributes coming from another type

0 Likes
963

I am trying to customize backoffice text search to use solr for Orders. Order has a code attribute and Order has entries, those entries have a vendorName. I need to be able to type in a name and then the solr index would form a query to search in code an orderEntryVendorName (this is how I called it when creating the impex script to set up the solr index). However, the query only takes into account code even though I am doing something like this.

<context component="myextension-order-fulltext-search" type="Order" principal="customersupportmanagerrole">
	<fs:fulltext-search>
		<fs:field-list>
			<fs:field name="code" selected="true"/>				
			<fs:field name="orderEntryVendorName"/>
		</fs:field-list>
		<fs:preferred-search-strategy>solr</fs:preferred-search-strategy>
		<fs:operator>OR</fs:operator>
	</fs:fulltext-search>
</context>

NOTE: The solr index part is already taken care of, my index of orders contains orderEntryVendorName it is just a matter of configuring myextension-backoffice-config.xml correctly to take into account orderEntryVendorName when searching in the solr index

Accepted Solutions (0)

Answers (1)

Answers (1)

jelly
Associate
Associate

As shown in your configuration, you add the orderEntryVendorName in the field-list, this is used for the filters, you can choose this filed in the filters and then this field will take effect in solr search.

But from your description, i suppose you want to this field take effect in simple search, so, there are two ways you can try:

1. Configure the simple-search field in your config.xml for Order type, something like below:

<context merge-by="type" type="Order" component="simple-search" >
   <ss:simple-search xmlns:ss="http://www.hybris.com/cockpitng/config/simplesearch">
      <ss:field name="code"/>
      <ss:field name="orderEntryVendorName"/>
   </ss:simple-search>
</context>

2. Enable the Free Text Query for orderEntryVendorName in backoffice administration cockpit

Find the index property orderEntryVendorName in Admin cockpit->Search and Navigation -> Indexed Types, open detail view of orderEntryVendorName, and navigate to FREE TEXT QUERY tab, choose True for Free Text Query.