Visits that include an on-site search convert two-to-three times higher than the average visit. When search is working well, consumers can more easily find the products they want, streamlining the customer journey.
When search is configured badly, the customer experience is poor and will directly impact conversion rates. Configuring Magento’s Solr integration correctly will allow customers to find what they want, leading to higher conversion rates.
Configuring Magento’s Solr integration allows customers to find what they want, leading to higher conversion rates.
Out-of-the-box Magento search presents challenges to an ideal search experience. Those challenges include:
- Relevance of search results
- Relevant search suggestions
- Performance (speed)
Solr, when properly configured, can overcome those challenges and provide a more ideal consumer search experience. Solr provides improved search performance and search results relevancy, support for spelling, synonyms, and stop words (words to ignore), and improved layered navigation performance. Solr is especially recommended for sites with heavy traffic, search loads, and large catalogs. Products are added to the search engine index as each product is saved in the Admin, so the index is kept up to date.
Solr (the software) is not included in Magento Enterprise Edition, and must be installed separately. However, Magento does ship with all of the code to use Solr, once it is installed.
Below, we will help both developers and business users understand what is available from Magento EE’s Solr integration.
Solr Configuration File (Solr version: 3.6.2)
The configuration for Solr’s search handling is made inside of the solrconfig.xml (generally located in [Solr base dir]/solr/conf). These configurations, however, can be overridden with parameters passed in the request from Magento.
Those “overrides” are configurations that can be made in the Magento Admin Panel.
defType | Query Parser Type
DisMax (<str name=”defType”>dismax</str>) is an abbreviation Disjunction Max, and is a popular query mode with Solr.
It is designed to process simple user-entered phrases (without heavy syntax) and search for the individual words across several fields using different weighting (boosts) based on the significance of each field, and it should never throw an exception.
Disjunction refers to the fact that your search is executed across multiple fields, e.g. title, body, and keywords, with different relevance weights.
Max means that if your word “foo” matches both title and body, the max score of these two (probably title match) is added to the score, not the sum of the two as a simple OR query would do. This gives more control over your ranking.
qf | Query Fields
List of fields and the “boosts” to associate with each of them when building DisjunctionMaxQueries from the user’s query.
Magento uses the fields: fulltext_1_en^1.0 fulltext_2_en^2.0 fulltext_3_en^3.0 fulltext_4_en^4.0 fulltext_5_en^5.0
In Magento, you can set the search weight for a field when using Solr. All fields with the same search weight, that are marked as searchable, are combined together into one field – giving them equal weight. All of the fields with the weight of “4” are combined into the “fulltext_4_en” field, and so on.
fq | Filter Query
This parameter can be used to specify a query that can be used to restrict the super set of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries, since the queries specified with fq are cached independently from the main query.
pf | Phrase Fields
Once the list of matching documents has been identified using the “fq” and “qf” params, the “pf” param can be used to “boost” the score of documents in cases where all of the terms in the “q” param appear in close proximity. The definition of proximity relies on Phrase Slop (next row). Example: “The quick brown fox” would not match “quick fox” unless you had a phrase slop of 1 (meaning you can get the exact phrase by moving a word ONE position).
ps | Phrase Slop
Default amount of slop on phrase queries built with “pf”, “pf2” and/or “pf3” fields (affects boosting).
qs | Query Phrase Slop
Amount of slop on phrase queries explicitly included in the user’s query string (in qf fields; affects matching).
mm | Minimum Match
When dealing with queries, there are three types of “clauses” that Lucene (Solr) knows about: mandatory, prohibited, and ‘optional’ (aka: “SHOULD”). By default, all words or phrases specified in the “q” param are treated as “optional” clauses unless they are proceeded by a “+” or a “-.” When dealing with these “optional” clauses, the “mm” option makes it possible to say that a certain minimum number of those clauses must match (mm).
Only return suggestions that result in more hits for the query than the existing query. Note that even if the given query term is correct (i.e. present in the index), a more popular suggestion will be returned (if one exists).
Provide additional information about the suggestion, such as the frequency in the index.
The maximum number of suggestions to return. Note that this value also limits the number of candidates considered as suggestions. You might need to increase this value to make sure you always get the best suggestion, even if you plan to only use the first item in the list.
The echoParams parameter tells Solr what kinds of Request parameters should be included in the response for debugging purposes.
Resulting Request Parameters To Solr
In the next blog post, we will discuss how Magento EE can take advantage of these Solr configurations to provide a superior search offering.