Documentation
Summary

Summary

Overview

The Summary component in an e-commerce platform is designed to enhance the search experience by automatically correcting user queries and providing a concise overview of the search results. Leveraging natural language processing (NLP) and machine learning algorithms, this feature detects and corrects spelling errors in user search queries. When a user enters a search term that might contain a typo or misspelling, the system checks the term against a comprehensive dictionary. If an error is detected, the Summary component suggests the correct spelling and adjusts the search results accordingly. For state, if a user searches for “iphone11” instead of “iPhone 11,” the system will correct the query and display results for “iPhone 11.” In addition to correcting search queries, the Summary component also displays the number of products currently shown, helping users understand the scope of their search results. This dual functionality not only improves user experience by ensuring more accurate search results but also provides real-time feedback on the effectiveness of the search query. By continuously learning from user interactions, the Summary component enhances its ability to recognize and correct spelling errors, thereby increasing the likelihood of users finding the products they seek, even if their initial search contained mistakes.

Usage

// importing component
import { Summary } from "@unbxd-ui/react-search-components";
 
// import the style for the component
import "@unbxd-ui/react-search-components/styles/summary.css";

If the styles import does not work, use the following code to import it:

require.resolve("@unbxd-ui/react-search-components/styles/summary.css")
⚠️
Note:

The Summary component must be used within the wrapper (in CSR, SSR and Custom Hooks approaches) to ensure that the component and the search functionality work properly.

Live Demo

Showing results for *
There are no products for this query.
// code for the above example
import { UnbxdSearchWrapper } from "@unbxd-ui/react-search-hooks";
import { FixedPagination, Products, Summary } from "@unbxd-ui/react-search-components";
 
<UnbxdSearchWrapper>
	...
	<Summary />
	<Products />
	<FixedPagination />
	...
</UnbxdSearchWrapper>

Props

styles

optional
object
  • This prop will be used to style the component.
  • The value must use a defined structure (the structure can be seen in the following example).
  • The keys in the structure must be the same while the values can changed as per the user's choice.
styles={{
    wrapper: "spellcheck-wrapper", // used for the wrapper component
    summaryText: "spellcheck-text", // used to show the query text
    productNumbers: "spellcheck-summary" // used to show the numbers of the currently shown products
}}

Related Hooks