Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not refer to search options by ID literals #16607

Merged

Conversation

cconard96
Copy link
Contributor

@cconard96 cconard96 commented Feb 22, 2024

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets !31553

The search engine makes some assumptions about search option IDs that is correct in most cases, but not all (like Followups). Rather than mess with changing search option IDs, the better solution is to replace all cases where we use hard-coded search option IDs to refer to a specific option.

For example, it assumes that ID 1 is always present and always the name field. In followups, this is the content field. Having the content field shown by default is very resource intensive. Worse, the default sort is always ID 1 which means the search query suddenly becomes much less performant as it has to scan the entire table. When creating criteria filters for followups in the webhook feature on a database with 1.5 million followups, it was taking approximately 18 seconds to load the tab. With these changes, I expect it to be a few ms only.

src/Search/SearchOption.php Outdated Show resolved Hide resolved
src/Search/SearchOption.php Outdated Show resolved Hide resolved
@cedric-anne cedric-anne merged commit 97038c4 into glpi-project:main Feb 27, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants