Search 1.9 billion lines of Odoo code on GitHub

base_search_macro

Author: Daniel Reis, Odoo Community Association (OCA)
License: AGPL-3
Branch: 8.0-search-macro
Repository: dreispt/server-tools
Dependencies: base
Languages: Python (104, 55.3%), XML (18, 9.6%), and reStructuredText (66, 35.1%)

<a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> </a> <a name="improved-name-search"></a> <h2>Improved Name Search</h2> <p>Extends the name search feature to use additional, more relaxed matching methods, and to allow searching into configurable additional record fields.</p> <p>The name search is the lookup feature to select a related record. For example, selecting a Customer on a new Sales order.</p> <p>For example, typing &quot;john brown&quot; doesn't match &quot;John M. Brown&quot;. The relaxed search also looks up for records containing all the words, so &quot;John M. Brown&quot; would be a match. It also tolerates words in a different order, so searching for &quot;brown john&quot; also works.</p> <img alt="images/image0.png" src="images/image0.png" /> <p>Additionally, an Administrator can configure other fields to also lookup into. For example, Customers could be additionally searched by City or Phone number.</p> <img alt="images/image2.png" src="images/image2.png" /> <p>How it works:</p> <p>Regular name search is performed, and the additional search logic is only triggered if not enough results are found. This way, no overhead is added on searches that would normally yield results.</p> <p>But if not enough results are found, then additional search methods are tried. The specific methods used are:</p> <ul class="simple"> <li>Try regular search on each of the additional fields</li> <li>Try ordered word search on each of the search fields</li> <li>Try unordered word search on each of the search fields</li> </ul> <p>All results found are presented in that order, hopefully presenting them in order of relevance.</p> <a name="installation"></a> <h3>Installation</h3> <p>No specific requirements.</p> <a name="configuration"></a> <h3>Configuration</h3> <p>The fuzzy search is automatically enabled on all Models. Note that this only affects typing in related fields. The regular <code>search()</code>, used in the top right search box, is not affected.</p> <p>Additional search fields can be configured at Settings &gt; Technical &gt; Database &gt; Models, using the &quot;Name Search Fields&quot; field.</p> <img alt="images/image1.png" src="images/image1.png" /> <a name="usage"></a> <h3>Usage</h3> <p>Just type into any related field, such as Customer on a Sale Order.</p> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/149/8.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>Also use fuzzy search, such as the Levenshtein distance: <a class="reference external" href="https://www.postgresql.org/docs/9.5/static/fuzzystrmatch.html">https://www.postgresql.org/docs/9.5/static/fuzzystrmatch.html</a></li> <li>The list of additional fields to search could benefit from caching, for efficiency.</li> <li>This feature could also be implemented for regular <code>search</code> on the <code>name</code> field.</li> </ul> <a name="bug-tracker"></a> <h3>Bug Tracker</h3> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="images"></a> <h4>Images</h4> <ul class="simple"> <li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li> </ul> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Daniel Reis &lt;<a class="reference external" href="https://github.com/dreispt">https://github.com/dreispt</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>This module is maintained by the OCA.</p> <p>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.</p> <p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>