====== Search and Navigation in the hybris Commerce Accelerator - Key Concepts and Features ====== The accelerators comes integrated with the Solr Search Engine. ===== Key Concepts ====== * It uses the default configuration of the **solrfacetsearch** extension. * **ValueProvider**: Returns the item -usually a model- which is going to be indexed. For example: the approved products. * **SolrIndexedProperty**: Each of the fields which is going to be indexed. It has a fieldValueProvider. For example: The code and description of the product. * **DisplayName**: This a localized atribute and contains the name of the property to show in the frontend. * **FieldValueProvider**: Returns the value of a field which is going to be indexed. For example: It calculates the price which is going to be stored in the Solr Index. * **Facets**: Property used to filter the results of Solr. * **SolrValueRange**: It groups the possible values of a solrIndexedProperty under a label. For example: "€ 10-19" groups all the prices between EUR 10.0 and 19.99. It is used with facets. * **SolrValueRangeSet**: It contains many SolrValueRanges. It used by SolrIndexedProperties which are multivalued. * The **commerceservices** extension extends solrfacetsearch * **productSearchService** exposes methods to search products or other business objects. * **productSearchFacade** does the same but it returns ProductData * The **seachStateData** is used to initiated the search. * The **productSearchPageData** contains the query, the products, the paging information, available sorts and the applied filters (search breadcrumbs) and facets and available facets. * **The solr index must only include purchasable products.** If you filter the returned products, the totals returned by Solr will be wrong. To improve the performance, **the Solr documents must include all the attributes required to build the product data object** of an object. If you are using a search engine, there is no advantage on using it, if you look for values on the database after you get the data from the search engine. ===== Key Features ====== * Search by **category** or using a **free text** * **Full or incremental indexing** * **Multiply categories hierarchies** (Product Categories, Brands and Classification). A implementation of CategorySource must be developed. * **Ordering of results**. Due to the Solr internal paging, a manual ordering won't work. * By Relevance (Solr Score) * Localizable names. priority, sorting and muti-select for facets. * Links to the classification attributes * **Category Facets** which are treated different as normal facets * **SearchPageController/CategoryPageController** * They initiate and continues a search. * It uses bookmarkeable URLs * Loads the appropriate CMS Page * Based on the **solrfacetsearch** * It uses the multi-core mode to allow an index for each Hybris type. * **SearchQueryPostProcessors** and **SearchResultPostProcessors** can be defined * **Keyword Redirect:** It enables to send the user to a URL or product when he enters some keyword. * **Stopword:** It's a word which is not going to be indexed, for example, in English, "the", "a" and "in" are stopwords. ===== Further Reading ====== [[https://wiki.hybris.com/display/tr52/Visual+-+Customizing+Product+Search+Page|Steps to add a field to the solr index and then make it available in the frontend]] [[https://wiki.hybris.com/display/tr52/Add+Custom+Properties+to+the+SOLR+index|Steps to add a facet to the solr index]] --Based on Hybris 6.1