Skip to content

Front End Integration

Iva Koevska edited this page Jan 18, 2017 · 5 revisions

After you have successfully generated, indexed, and published your data, your Fredhopper instance is ready to answer queries and serve your hybris-based site. You need to update your front-end to process the search requests and responses.

Hybris Integration

You can find the Spring bean configurations that handle the integration in fredhoppersearch-query-spring.xml.

The Fredhopper/SAP Hybris Connector extension ports the Solr logic for search request and response formats to Fredhopper. To achieve this, the Connector injects Fredhopper-specific ProductSearchService and SearchResponse populators into the existing hybris framework. For example, the DefaultFhProductSearchService logic substitutes the standard hybris ProductSearchService implementation.

The provided Fredhopper implementation interacts with the query-lang-X.XX.X.jar, a software library to manipulate the Fredhopper Query API, generate queries, and construct response objects. The Fredhopper Query API connects Fredhopper with front-end applications and lets you create Fredhopper functionalities in your presentation layer.

Generating Queries

To execute a search, a Query object is constructed from the various search parameters and passed to FhQueryService. Next, a web service call is executed against the Fredhopper instance.

The resulting XML response is passed back to the DefaultFhProductSearchService in the form of a Page object.

What to do in your front-end: You need to use the Fredhopper Query API to construct your queries to Fredhopper. For more information, see Fredhopper Learning Center: Front-end integration.

Processing Responses

The Connector relies on defaultFhSearchResponseConverter and the implementation of its populators to translate the Page object into a standard hybris ProductCategorySearchPageData data transfer object (DTO).

The defaultFhSearchResponseConverter bean is called from the DefaultFhProductSearchService to populate the ProductCategorySearchPageData DTO. Its fhDocumentSearchResultValuePopulator populator is responsible for extracting the product details from the response.

What to do in your front-end: Because the Connector takes care to translate the query results to the standard ProductCategorySearchPageData, you can leave the front-end which handles query results virtually untouched. Layers above ProductSearchService do not require any changes to work with the input.