The search for plain text is currently using
% at the beginning and end. This works pretty well when searching and we already know what may be the result (so for back-office users).
But this is not enough natural for casual users or even for external user (like web user). Such audience expect to search like in web search site.
For example it would be useful to implement a search on product for a web-shop.
I propose to add a parameter
search_full_text (similar to
Dict field, set to
False by default and set to
ilike operator with a starting and ending
% in value (or no wildcard) are converted into a full text search clause, if the back-end supports it like this:
[('description', 'ilike', '%foo bar%')]
(description @@ websearch_to_tsquery('foo bar')).
If the field is translatable then,
(to_tsvector(<language>, description) @@ websearch_to_tsquery(<language>, 'foo bar'))
where the correspondence between the database language and the Tryton code comes from the configuration with a fallback to
A contextual key
<model>.<field>.search_full_text permits to disable or force (without transformation) the conversion of the clause if the field has
Ordering on the
Char field with a contextual key
<model>.<field>.rank_full_text will use the rank of the full text matching if the back-end supports it otherwise it is