# Search widget behaviour

**URL:** <https://discuss.tryton.org/t/search-widget-behaviour/6928>\
**Category:** Developer\
**Created:** [January 30, 2024, 11:27am UTC](https://discuss.tryton.org/t/search-widget-behaviour/6928 "2024-01-30T11:27:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xavi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/8e8cbc/32.png) [@Xavi](https://discuss.tryton.org/u/Xavi)\
**Post date:** [January 30, 2024, 11:27am UTC](https://discuss.tryton.org/t/search-widget-behaviour/6928/1 "2024-01-30T11:27:34Z")

</div>

Hello,  
Im having problems with the search bar filtering records, I have a Char field which contains a file path: `path = fields.Char('Path')`, (ex: /example/path\_to/file).  
So, if the user wants to filter all the records from “path\_to” (notice the ‘\_’), using the syntax `"Path": path_to` returns nothing, so after reading:

> [@Strange behaviour when searching for words in Text field](https://discuss.tryton.org/t/strange-behaviour-when-searching-for-words-in-text-field/1518):
>
> First, I know that having Text fields in a list view is expensive on resources. But if the users want it, I wouldn’t complain because they have to work with the system. The field we are talking about is defined as Text field on sale.line: description = fields.Text('Description') In this case the user wants to search for a very specific rare spare part. This part is not added as a regular product in Tryton, because it’s very rare so a general product is used for this. When adding to a sale, th…

And:

> **[Client Usage — Tryton desktop client](https://docs.tryton.org/latest/client-desktop/usage.html)**

I see that the default operator in my case is ‘ilike’ and it acts as a starts with.

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/2/270272934ec1097c9962d39fc87f6919c7bca033.png)

but for me thats not a starts with at all:

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/3/3db77d03ee00836f4e80b16267f0253f88be0823.png)

My question is, how can I filter the record with ‘\_’ in the string?  
for example in the tryton demo i’ve renamed a product with `A3_Paper_250`, how could I found this exact product? (without searching the exact name) I’ve tried with:

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/7/7025b8b01f4dfbf636579996d7576c537c6f4f70.png)  
And:  
 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/d/daeffab41bc6a321abadf533762887f359b486e1.png)  
In my case, searching: `"Path": %path_to%` works fine but I don’t think the user should be searching like this.  
Thanks.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [January 30, 2024, 11:47am UTC](https://discuss.tryton.org/t/search-widget-behaviour/6928/2 "2024-01-30T11:47:12Z")

</div>

`_` is the single wildcard when `%` is multiple wildcards.  
So if you really want to match with something containing `_`, you must escape it with `\_`.

Here is an improvement of the documentation: [Improve documentation about escaping wildcards (!1182) · Merge requests · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/merge_requests/1182)

---

<div class="post-metadata">

**Author:** ![Xavi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/8e8cbc/32.png) [@Xavi](https://discuss.tryton.org/u/Xavi)\
**Post date:** [January 30, 2024, 12:14pm UTC](https://discuss.tryton.org/t/search-widget-behaviour/6928/3 "2024-01-30T12:14:35Z")

</div>

Well, in my opinion using/escaping wildcards is not friendly with the user, and I think they will find more problems because of not knowing how this works, than taking advantage of it. Anyways, thank you for the documentation update now Its clear for me.
