# How to limit many2one's lookup results?

**URL:** https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187
**Category:** User
**Created:** [February 25, 2019, 7:14am UTC](https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187 "2019-02-25T07:14:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![xar](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/977dab/32.png) [@xar](https://discuss.tryton.org/u/xar)
#### Post date: [February 25, 2019, 7:14am UTC](https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187/1 "2019-02-25T07:14:50Z")

</div>

Hello !

In a form, I have a many2one filed, refering to a table with +100k rows.  
For some cases, the amount of result can be more than 10 or 20k.  
Especially on sao, retrieving all the results can take minutes, preventing the user to continue typing an precising his query.

Is there a way to limit the results to the first 50 of 100 first records ?

Thank you for your help.

---

<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: [February 25, 2019, 7:52am UTC](https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187/2 "2019-02-25T07:52:58Z")

</div>

The completion is limited to the `client.limit` which is 1000 by default. This should not be slow except if the rec\_name computation is slow then it should be improved.

---

<div class="post-metadata">

### Author: ![xar](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/977dab/32.png) [@xar](https://discuss.tryton.org/u/xar)
#### Post date: [February 27, 2019, 7:09am UTC](https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187/3 "2019-02-27T07:09:10Z")

</div>

I changed sao.js / Sao.config.limit and Sao.config.display\_size. The server load seems lighter.  
The models are not complex to compute, but my server is really low cost (OVH/VPS SDD1).

Thank you Cedric.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [March 29, 2019, 7:09am UTC](https://discuss.tryton.org/t/how-to-limit-many2ones-lookup-results/1187/4 "2019-03-29T07:09:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
