Files
Odoo-18.0-20251222/base_search_fuzzy/readme/USAGE.md
tocmo0nlord adbe430761
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled
Initial commit: Odoo 18.0-20251222 extra-addons
2026-03-13 20:43:25 +00:00

29 lines
1.0 KiB
Markdown
Executable File

1. You can create an index for the name field of res.partner.
2. In the search you can use:
`self.env['res.partner'].search([('name', '%', 'Jon Smit')])`
3. In this example the function will return positive result for John
Smith or John Smit.
4. 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 statement:
`self.env.cr.execute("SELECT set_limit(0.2);")`
For further questions read the Documentation of the
[pg_trgm](https://www.postgresql.org/docs/current/static/pgtrgm.html)
module.
## Usage with demo data
There are some demo data that allow you to test functionally this module
if you are in a **demo** database. The steps are the following:
1. Go to *Contacts* and type the text **Jon Smith** or **Smith John**
in the search box and select **Search Display Name for: ...**
2. You will see two contacts, and they are the ones with display names
**John Smith** and **John Smizz**.