AdvancedCustomFields / AdvancedCustomFields/acf

Ajax search on Select2 and Relationship fields not optimal (Pro and Free)

Open
#484 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

The Ajax calls on the relationship fields used for search is doing a search on every keypress when typing, this results in a call to the database on every key press, this also results in a query with 3 LIKES which is not optimal.

When you have a site with 100k posts this call destroys your database performance especially on an RDS or any cloud DB.

Changing this to only search after the 3rd letter or with a timeout will ease the problem. or even having a search submit after the user has entered the term would probably be better.

N.B. I advise anyone to not use these two fields on a big site until the issue has been resolved, or create your own custom field for ACF to fix these issues.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the Ajax search calls for Select2 and Relationship fields and inspect the generated database queries; done should mean searches no longer query on every keypress and avoid the costly three-LIKE query for large sites.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.