Fuzzy Search
This addon provides the ability to create GIN or GiST indexes of char and text fields and also to use the search operator % in search domains. Currently this module doesn’t change the backend search or anything else. It provides only the possibilty to perfrom the fuzzy search for external addons.
Table of contents
Installation
- The PostgreSQL extension pg_trgm should be available. In debian based distribution you have to install the postgresql-contrib module.
- Install the pg_trgm extension to your database or give your postgresql user the SUPERUSER right (this allows the odoo module to install the extension to the database).
Configuration
If the odoo module is installed:
- You can define GIN and GiST indexes for char and text via Settings -> Database Structure -> Trigram Index. The index name will automatically created for new entries.
Usage
You can create an index for the name field of res.partner.
In the search you can use:
self.env['res.partner'].search([('name', '%', 'Jon Miller)])
In this example the function will return positive result for John Miller or John Mill.
You can tweak the number of strings to be returned by adjusting the set limit (default: 0.3). NB: Currently you have to set the limit by executing the following SQL statment:
self.env.cr.execute("SELECT set_limit(0.2);")
Another interesting feature is the use of similarity(column, 'text') function in the order parameter to order by similarity. This module just contains a basic implementation which doesn’t perform validations and has to start with this function. For example you can define the function as followed:
similarity(%s.name, 'John Mil') DESC" % self.env['res.partner']._table
For further questions read the Documentation of the pg_trgm module.
Known issues / Roadmap
- Modify the general search parts (e.g. in tree view or many2one fields)
- Add better order by handling
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Authors
- bloopark systems GmbH & Co. KG
- Eficent
- Serpent CS
Contributors
- Christoph Giesel <https://github.com/christophlsa>
- Jordi Ballester <jordi.ballester@eficent.com>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Dave Lasley <dave@laslabs.com>
- Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainers
This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/server-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Python dependencies
Package | Version | Secured | ||
---|---|---|---|---|
psycopg2_binary | 2.8.6 |
Available languages
Language | % translated | ||
---|---|---|---|
French / Français |
85%
|
||
Slovenian / slovenščina |
85%
|
||
German / Deutsch |
85%
|
||
Finnish / Suomi |
45%
|
||
Portuguese (BR) / Português (BR) |
45%
|
||
Croatian / hrvatski jezik |
45%
|
||
Italian / Italiano |
45%
|
||
Dutch / Nederlands |
40%
|
||
Arabic / الْعَرَبيّة |
40%
|
||
Turkish / Türkçe |
40%
|
||
Chinese (Simplified) / 简体中文 |
40%
|
||
Dutch / Nederlands |
40%
|
||
Norwegian Bokmål / Norsk bokmål |
40%
|
||
Turkish / Türkçe |
40%
|
||
Romanian / română |
40%
|
||
Croatian / hrvatski jezik |
40%
|
||
English (UK) |
35%
|
||
Portuguese / Português |
35%
|
||
Slovak / Slovenský jazyk |
35%
|
||
Japanese / 日本語 |
35%
|
||
Bosnian / bosanski jezik |
35%
|
||
Vietnamese / Tiếng Việt |
35%
|
||
Spanish (CO) / Español (CO) |
35%
|
||
Spanish (AR) / Español (AR) |
35%
|
||
Mongolian / монгол |
35%
|
||
Polish / Język polski |
35%
|
||
Bulgarian / български език |
35%
|
||
Spanish (PE) / Español (PE) |
35%
|
||
Portuguese / Português |
35%
|
||
Spanish (VE) / Español (VE) |
35%
|
||
Dutch (BE) / Nederlands (BE) |
35%
|
||
Spanish / Español |
35%
|
||
Ukrainian / українська |
35%
|
||
Hungarian / Magyar |
35%
|
||
Hebrew / עִבְרִי |
35%
|
||
Spanish (CL) / Español (CL) |
35%
|
||
Spanish (DO) / Español (DO) |
35%
|
||
Serbian (Latin) / srpski |
35%
|
||
Chinese (Traditional) / 繁體中文 |
35%
|
||
Spanish (EC) / Español (EC) |
35%
|
||
Macedonian / македонски јазик |
35%
|
||
French (CH) / Français (CH) |
35%
|
||
Estonian / Eesti keel |
35%
|
||
Swedish / Svenska |
35%
|
||
Indonesian / Bahasa Indonesia |
35%
|
||
Spanish (MX) / Español (MX) |
35%
|
||
Spanish / Español |
35%
|
||
Thai / ภาษาไทย |
35%
|
||
Persian / فارس |
35%
|
||
Russian / русский язык |
30%
|
||
French (CA) / Français (CA) |
30%
|
||
Vietnamese / Tiếng Việt |
25%
|
||
Spanish (CR) / Español (CR) |
25%
|
||
Greek / Ελληνικά |
25%
|
||
Latvian / latviešu valoda |
25%
|
||
Spanish (PY) / Español (PY) |
25%
|
||
Lithuanian / Lietuvių kalba |
25%
|
||
Lithuanian / Lietuvių kalba |
25%
|
||
Galician / Galego |
5%
|
||
Galician / Galego |
5%
|