If you enable the "Suggestions depend on other filter fields" option, then the other exposed filters will be taken into account when returning results for the autocomplete.

However, the Drupal autocomplete functionality will cache results that were previously returned, even if they are no longer valid for the current values of the other exposed filters.

So, for example:

  1. If we have two exposed filters: Title and Content Type
  2. Title has both "Use Autocomplete" and "Suggestions depend on other filter fields" enabled
  3. We have two peices of content on the site: one Article called "Here is an article" and one Basic page called "Here is a basic page"
  4. Now, on the View, if we set "Content type" to "Article" and type "Here" into the title - it'll return "Here is an article" in the autocomplete.
  5. But if we change the "Content type" to "Basic page" and type "Here" (with out reloading the page in between) it'll still show "Here is an article" because the results are cached!
  6. If we type more, for example, "Here is" then it'll show us "Here is a basic page"

In order for this functionality to work correctly, it needs to clear the autocomplete cache before submitting a request which has different dependent filter values than the last time the request was submitted.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek’s picture

Issue tags: +panopoly
dsnopek’s picture

Status: Active » Needs review
FileSize
1.21 KB

Attached is a patch that clears the autocomplete cache when the dependent filters are different than the last call to the server. Please let me know what you think!

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #2 is RTBC. Thanks @dsnopek!