EE's core Search add-on currently limits search to 50 custom fields. It looks like a flaw in the code effectively reduces this limit much further, by counting custom fields once for each channel in which they're used. Custom fields which are common across many channels can eat up the 50-field limit very quickly, and cause other fields to not be searched, making the Search add-on much less useful.
The screenshot shows lines 389–395 of mod.search.php. This code is run for each channel being searched, and gathers together all of the custom fields. Note line 392, which uses the field ID as the array key. Whatever was intended there, array_merge then undoes it, because it renumbers array elements. The effect is that custom fields are then duplicated in the collected array, once per channel in which they're used. The 50-field limit is then very easily reached, and some fields can be omitted from search.
I think there might be a simple solution here. Using array_replace, in place of array_merge, basically fixes this at a stroke for me. It merges the arrays, without renumbering the array keys, so custom fields aren't duplicated.
In my case, I had been easily exceeding the 50-field limit, because of custom fields common across many channels, and as a result some important custom fields were being omitted from search. With this simple change, I'm now way below the field limit, and search results appear complete.
EE's core Search add-on currently limits search to 50 custom fields. It looks like a flaw in the code effectively reduces this limit much further, by counting custom fields once for each channel in which they're used. Custom fields which are common across many channels can eat up the 50-field limit very quickly, and cause other fields to not be searched, making the Search add-on much less useful.
The screenshot shows lines 389–395 of
mod.search.php. This code is run for each channel being searched, and gathers together all of the custom fields. Note line 392, which uses the field ID as the array key. Whatever was intended there,array_mergethen undoes it, because it renumbers array elements. The effect is that custom fields are then duplicated in the collected array, once per channel in which they're used. The 50-field limit is then very easily reached, and some fields can be omitted from search.I think there might be a simple solution here. Using
array_replace, in place ofarray_merge, basically fixes this at a stroke for me. It merges the arrays, without renumbering the array keys, so custom fields aren't duplicated.In my case, I had been easily exceeding the 50-field limit, because of custom fields common across many channels, and as a result some important custom fields were being omitted from search. With this simple change, I'm now way below the field limit, and search results appear complete.