Fuzzy Search Product | Product Search Fuzzy
by Ishan Incubator https://ishan-incubator.odoo.com/
Odoo
$ 44.99
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Sales (sale_management)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 39 |
| Technical Name |
ii_fuzzy_search_product |
| License | LGPL-3 |
| Website | https://ishan-incubator.odoo.com/ |
| Versions | 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Sales (sale_management)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 39 |
| Technical Name |
ii_fuzzy_search_product |
| License | LGPL-3 |
| Website | https://ishan-incubator.odoo.com/ |
| Versions | 17.0 18.0 19.0 |
Fuzzy Search Product | Product Search Fuzzy
How to Use:
Introduction
We have introduced a new method called fuzzy_search() as an alternative to the traditional
search() method in the Product Template and Product Variant models.
This function is designed to improve product searching by handling typographical errors, spelling variations,
and partial matches in product names.
Method Parameters
When calling fuzzy_search(), you need to pass three parameters:
- search_term: The keyword or product name you want to search. Example: "aple" (misspelled) will still match "Apple".
-
limit (optional):
Defines the maximum number of results to return.
The default value is
5. -
score (optional):
Defines the minimum similarity score threshold between the search term and product names.
The score ranges from
0â100, with a higher value requiring a closer match. The default value is70.
Example Usage
# Search for a product by fuzzy match
result = self.env['product.product'].fuzzy_search("aple", 5, 70)
In the example above, although the search term is "aple" (with a typo), the function will successfully return products like "Apple" because the similarity score (⥠70) is satisfied.
Benefits
- Improves product search accuracy, even with spelling mistakes or incomplete words.
- Helps end-users find products faster without needing the exact product name.
- Configurable
limitandscoreparameters for flexible usage.
Please log in to comment on this module