Skip to Content
Menu

Full-text search

by
Odoo

41.67

v 18.0 Third Party
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 764
Technical Name us_full_text_search
LicenseOPL-1
Versions 16.0 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 764
Technical Name us_full_text_search
LicenseOPL-1
Versions 16.0 17.0 18.0

Full-text search powered by UnitSoft

Search records all across your database in Odoo

Features

1Easy Access From Anywhere

2Advanced Query Options

3Selective Filtering

4Search history

Documentation

System Requirements

To enhance search performance, the module uses the pg_trgm extension for PostgreSQL. This extension enables faster full-text search, especially for partial word matches.

  • If your database user has superuser privileges, the module will automatically install pg_trgm during setup.
  • If the extension is already installed, it will be used without requiring additional permissions.
  • If pg_trgm cannot be installed (e.g., due to lack of superuser privileges), the module will still function, but search performance may be reduced.

Without pg_trgm, the system will use a standard full-text search index, which may be slower when processing complex queries or large datasets.

Usage

Performing a Search

To start a search, enter a query in the search field available in the module's interface. As you type, the system will display a history of queries similar to your current input or the last 10 queries if the field is empty. You can select one of the suggested queries or enter a new one and click the "Search" button. The system will perform a full-text search across all database tables. For more precise results, you can:

  • Enable filtering by activating the corresponding toggle switch.
  • Select or deselect specific tables to refine the search scope.

Once the filters are configured, apply them to view the updated results.

By default, search results display only the titles of records where matches were found, along with an "Open" button. If additional details are needed, users can enable the display of the model name where the match was found, the record identifier, and the full JSON record. These fields are optional and can be enabled via the "Custom Fields" menu in the list view. This allows users to tailor the search results display according to their specific needs.

Using Special Characters in Queries

The module supports the use of special characters to construct more complex queries. This feature allows you to perform searches that are more precise and tailored to specific needs.

Examples of Special Characters

  • Double Quotes ("): Use double quotes to search for an exact phrase. For example, entering "network security" will only return results where these two words appear together as a phrase.
  • Pipe (|): Use the pipe symbol to find documents with at least one of the specified words. For instance, searching for network|security will return documents that contain either 'network' or 'security'.
  • Exclamation Mark (!): Use an exclamation mark to exclude documents containing a specific word. For example, entering hardware !USB will exclude any records containing 'USB'.
  • Parentheses (()): Use parentheses to group words or phrases to clarify the search logic. This can refine your searches significantly, for example, (network | security) hardware.
  • Colon Asterisk (:*): Use this after a word to search for prefixes. For example, net:* will find records containing 'net', 'nets', 'network', etc.

These special characters can be combined to formulate complex queries, maximizing the utility of the search functionality.

Module Architecture

The text search module consists of two main components: data preparation and the search algorithm.

Data Preparation and Updates

This stage includes collecting the necessary records, keeping them up to date, and indexing them. The json.archive model is responsible for collecting and storing data in a structured format. Before installing the module, a preliminary processing of all records is performed. The IDs of the required records are gathered into the queue table for further processing. After installation, every 3 minutes, a scheduled action triggers the process_queue_records method, which processes the queue, converts the records into JSON format, and stores them centrally.

Important! Since records are processed gradually, not all data will be available for search immediately after installation. Don’t worry—the system is functioning correctly, but some patience is required. Processing time can range from 10 minutes to several hours, depending on the size of your database. This process does not interfere with the normal operation of the system.

Data accuracy is maintained through triggers on updates, additions, and deletions, ensuring real-time consistency. Indexing structures the data for fast access.

Search Algorithm

The search component processes user queries, retrieves results, and filters them. The full.text.search model manages this process. The button_search method processes the query, fetches relevant records from json.archive, and ranks them based on relevance. Results are displayed with highlighted matches, and filtering allows users to focus on relevant records by table name.

Документація

Системні вимоги

Для підвищення продуктивності пошуку модуль використовує розширення pg_trgm для PostgreSQL. Це розширення значно пришвидшує повнотекстовий пошук, особливо для часткових збігів у словах.

  • Якщо користувач бази даних має права суперюзера, модуль автоматично встановить pg_trgm під час налаштування.
  • Якщо розширення вже встановлене, воно буде використовуватись без необхідності додаткових налаштувань.
  • Якщо встановлення pg_trgm неможливе (наприклад, через відсутність прав суперюзера), модуль все одно працюватиме, але швидкість пошуку може бути нижчою.

Без pg_trgm система використовуватиме стандартний індекс повнотекстового пошуку, який може бути менш ефективним при обробці складних запитів або великих обсягів даних.

Використання

Проведення пошуку

Щоб розпочати пошук, введіть запит у поле пошуку, доступне в інтерфейсі модуля. Під час введення система відображатиме історію запитів, що схожі на поточний, або останні 10 запитів, якщо поле порожнє. Ви можете вибрати один із запропонованих запитів або ввести новий і натиснути кнопку "Пошук". Система виконає пошук за текстом у всіх таблицях бази даних. Для точнішого результату ви можете:

  • Увімкнути фільтрацію, активувавши відповідний перемикач.
  • Обрати конкретні таблиці або скасувати їх вибір, щоб обмежити пошук лише потрібними даними.

Після налаштування фільтрів застосуйте їх, щоб переглянути оновлені результати.

За замовчуванням у результатах пошуку відображаються лише заголовки записів, у яких знайдено збіги, та кнопка "Відкрити". Якщо потрібні додаткові деталі, користувач може увімкнути відображення назви моделі, в якій знайдено збіг, ідентифікатора запису, а також переглянути повний JSON-запис. Ці поля є опціональними і можуть бути увімкнені через меню "Настроювані поля" у списковому поданні. Це дозволяє адаптувати відображення результатів відповідно до індивідуальних потреб.

Використання спеціальних символів у запитах

Модуль підтримує використання спеціальних символів для створення більш складних запитів. Ця функція дозволяє вам виконувати більш точні пошуки, адаптовані до конкретних потреб.

Приклади спеціальних символів

  • Подвійні лапки ("): Використовуйте подвійні лапки для пошуку точної фрази. Наприклад, введення "мережна безпека" поверне лише ті результати, де ці два слова зустрічаються разом як фраза.
  • Вертикальна риска (|): Використовуйте вертикальну риску для пошуку документів, що містять принаймні одне зі вказаних слів. Наприклад, пошук за запитом мережа|безпека поверне документи, що містять або 'мережа', або 'безпека'.
  • Знак оклику (!): Використовуйте знак оклику для виключення документів, що містять конкретне слово. Наприклад, введення апаратне !USB виключить усі записи, що містять 'USB'.
  • Дужки (()): Використовуйте дужки для групування слів або фраз, щоб уточнити логіку пошуку. Це може значно уточнити ваші запити, наприклад, (мережа | безпека) апаратне.
  • Двокрапка з зірочкою (:*): Використовуйте це після слова для пошуку префіксів. Наприклад, мереж:* знайде записи, що містять 'мереж', 'мережі', 'мережа' тощо.

Ці спеціальні символи можна комбінувати для формулювання складних запитів, максимізуючи корисність функціоналу пошуку.

Архітектура модуля

Модуль пошуку за текстом складається з двох основних компонентів: підготовки даних та алгоритму пошуку.

Підготовка даних та їх актуалізація

Цей етап включає збір необхідних записів, підтримку їхньої актуальності та індексацію. Модель json.archive відповідає за збір та збереження даних у структурованому вигляді. Перед встановленням модуля виконується попередня обробка всіх записів. ID необхідних записів збираються в таблицю queue для подальшої обробки. Після встановлення, кожні 3 хвилини за допомогою запланованої дії викликається метод process_queue_records, який обробляє чергу, конвертує записи у формат JSON і централізовано зберігає їх.

Важливо! Оскільки записи обробляються поступово, одразу після встановлення не всі дані будуть доступні для пошуку. Не хвилюйтеся, система працює коректно, але потрібно трохи зачекати. Час обробки може становити від 10 хвилин до кількох годин, залежно від обсягу вашої бази даних. Цей процес не впливає на основну роботу системи.

Актуальність даних підтримується тригерами на оновлення, додавання та видалення, що забезпечує їхню постійну відповідність реальному стану. Індексація структурує дані для швидкого доступу.

Алгоритм пошуку

Компонент пошуку обробляє запити користувачів, отримує результати та виконує їх фільтрацію. Модель full.text.search керує цим процесом. Метод button_search обробляє запит, отримує відповідні записи з json.archive та ранжує їх за релевантністю. Результати відображаються з підсвіченими збігами, а фільтрація дозволяє користувачам зосередитися на відповідних записах за назвою таблиці.

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.