Decide on a strategy to handle huge lists of options

Created on 22 September 2014, over 10 years ago
Updated 14 February 2024, 11 months ago

Problem

Entity reference and term reference in particular have the general problem of knowing on not knowing how many options they are referencing too. In case of a vocabulary, it might be 5,20 or hundreds of thousands.

Right now, we have OptionsProviderInterface which those field types implement to provide all possible options to callers, like select widgets. However, if the number of values becomes too high it's not feasible any more to use select widgets, views exposed filter forms or Rules data input widgets.

Also one could argue that having an OptionsProvider does not fit for an autocompleted tag-style vocabulary as usually they are only auto-completed and the set of options is not limitted.

Possible solutions

Let's discuss the approach taken to deal with this situation. I see the following options:

a) Make it configurable. Users can configure for entity reference fields and taxonomy terms whether they should be rendered as select lists, e.g. in views exposed forms. That's the approach taken by ER fields in d7. In addition to exposing new settings, we'd have to come up with an implementation that only provides the options provider for those fields if configured.

b) Extend the interface with a countOptions() method which provides callers with an easy way to check for the number of available options, so the caller can decide whether it's safe / reasonable to make use of the options. E.g., this could be used to select a fitting "default widget" in views exposed filter forms or Rules data input widgets. Also, we could modify the interface to limit the number of returned values by a safe value.

c) Do not deal with it and default to "safe" default widgets where unknown. Easy, but not nice when you get only an autocomplete for a controlled taxonomy vocabulary with 5 entries (e.g. views exposed filter forms).

📌 Task
Status

Active

Version

9.5

Component
Field 

Last updated 1 day ago

Created by

🇦🇹Austria fago Vienna

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany donquixote

    There are two issues with long select lists:

    • Server-side performance and memory impact of building the option list, especially if we need to load all the entities. See 🐛 Options Select Widget: High Memory usage Active .
    • Network and client-side impact.

    In my experience, we run into the first problem much earlier than the second problem.

Production build 0.71.5 2024