Better e-commerce through MongoDB multi-faceted search
What is an e-commerce website without the on-site search function? When prospective customers visit a site, they already know what they are looking to purchase, which is why they are most likely to go straight to the search box. Take a look at these statistics:
- 30% of online visitors prefer to use the search site box to look for products of their interest
- Visitors using search converted at 8x more than the average conversion rate, contributing to 13.8% of site revenue
A versatile search button can make a great difference to a customer’s shopping experience. Well-designed, contextual filters can help customers quickly find the product they are looking for. Yet, only 40% of websites have faceted search which is necessary for contextual filters.
What is faceted search?
Faceted search is searching for items in a set by applying filters for various properties of the item. Eg: Searching for an item in an e-commerce site by applying filters for brand, model, price range etc. It serves to narrow down search results to show the visitors only those items they are actually interested in.
Faceted Search from MongoDB
MongoDB is fast becoming the favoured NoSQL database in e-commerce sites and a good reason for this, apart from its scalability and high availability, is its highly flexible multifaceted search feature.
Popular e-commerce websites like Otto, Expedia, ADP, Snapdeal are using MongoDB to provide their customers with an enriching experience.
MongoDB’s multifaceted search feature allows visitors to quickly locate their product by entering multiple facets or attributes that define the product. It also accepts free-form keywords for search which is highly useful when a visitor may not know the exact keyword to search for. But a Full Text Search is still nascent in MongoDB and can slow down performance in large applications.
The search can be based on multiple and/or conditions (intersections and Unions). The search box can be structured to show the users a drop down containing all possible facet values that they can employ in their search and also show the number of available items in each value.
A typical facet filter showing attributes and values for those attributes may look like this:
Size Color Brand
XXL (14) Blue (28) Brand A (20)
XL (10) Green (25) Brand B (32)
L (22) Red (25) Brand C (26)
It is best to keep the number of attributes low to get better performance and ensure optimal user experience at all times.
Performance also depends on the order of indexes used in the search. Make your search more efficient by suitably ordering filters and placing the most effective filter first so that the minimum number of entries are scanned to return search results. Identify primary fields that are critical to your search. Limit number of fields as the more storage required, the slower the search
Making use of index intersections in MongoDB
Indexes are necessary for a search function to work efficiently but they also add to the storage and disk IO, not to mention the cost of maintaining them. Traditionally, the MongoDB query planner could use only one index. So if you want to query on multiple fields together, you need to create compound indexes. With index intersection, this is no longer a necessity. Index intersection processes individual indexes and presents the user with an intersection of the results, so only those data that actually match the query are pulled into memory. CPU usage is more in this case, but the IO calls are a lot less, leading to more efficient memory utilization and better performance. Indexes can also intersect with themselves up to 10 times. This is useful when you need to specify more than one value for a single attribute.
MongoDB’s indexing feature is built into the data store so that no additional storage or software is needed. Search is done through a single query which provides good speed when indexes are structured correctly (the most limiting or restrictive index is placed first in the query).
Faceted Search – a necessity for today’s e-commerce
Faceted search has become an integral part of large e-commerce platforms selling a wide range of products. With facets, almost any attribute can be converted to a category.
MongoDB faceted search brings you the benefits of a search engine sans the high cost and effort of incorporating one. Agility is core to the success of an e-commerce site. With MongoDB’s multifaceted search, you get the benefit of lightning speed searches, and when your customers quickly find what they are looking for, guess who stands to gain?