I perform a search in the hosts view that takes ~10 seconds to complete and returns 100 hosts. Typically if you search for installed packages, this takes a little while (have ~500 hosts). The first page result gives me a list of 20 hosts. If I now at the bottom right click the > button to show me the next 20 hosts, Foreman seems to perform the same search again since I now have to wait another 10 seconds. Going between the pages of “20 hosts” should be instant since I already made the search once, right?
On Foreman 3.7.0/Katello 4.9.1.
I believe that the search queries apply pagination as well to prevent long load times or potentially too large response payloads.
I don’t know where to look in case of UI, but for API, you can check the pagination params here.
If you wish to change the default number of results per page, you can set the relevant global configuration option:
Administer > Settings > General > entries_per_page
Did some tests and with two different searches and it indeed seems like the search do “cut off” when the “per page” result has been filled.
ex.
This took 12 seconds:
https://foreman.internal/hosts?per_page=20&page=1&search=installed_package_name++%3D++mariadb-server
This took 24 seconds.
https://foreman.internal/hosts?per_page=40&page=1&search=installed_package_name++%3D++mariadb-server
I guess I imagined that it actually returned the full result and just did not show it to me on the page. Increasing the search results per page will not really save me any time then, I just have wait longer for the first result to show.
Thanks for the explanation.
Side note: @Partha_Aji is working on improving the performance of that query