Allow searching for ACFs
Summary
ACFs can be configured in the Hub to be indexed for search.
Description
ACFs can be configured in the Hub to be indexed for search. When publishing a content, all values of the selected ACFs are concatenated and published into a new field "customSearchTerms" and then indexed by the indexing service. This new field can then be included for full-text searches in the Catalog-API using a new enum value "CUSTOM_TERMS" for searchFields.
How to configure
Please see this Video for a walkthrough of the setup:
https://www.loom.com/share/51669e9cea324405885bc3c8ca07d65c?sid=0de42c40-e066-4d40-8cc7-94b541a30c84
Example setup (making image titles searchable)
- Login to the Hub as Admin
- Navigate to ACF > Field Groups > Create a new field group OR edit an existing field group
- Create the following items
- a) an ACF field with type "image" and type in "title" in field "Index fields"
- b) an ACF field with type checkbox (fill out available checkboxes in "choices" field, e.g. 'checkbox 1 : Value 1'). Then type in "checkbox_feld" in field "Index fields"
- Save your changes
- Create an article, scroll down and find the image ACF field
- a) upload an image and check the title of the image in the media library (e.g.: apple) b) search for the created checkbox field and hit the checkbox
- Publish the article
- a) hit the query with search term "apple" b) hit the query with search term "checkbox 1" -> query shows exactly 1 post as result
This only affects posts that are published after the configuration has been setup. If you want this to work for all already existing articles in a Hub, it is necessary to republish all of them via Bulk-Publish.
It is not allowed that the same ACF field name is used in more than one field group, a warning will be displayed.