Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom query on autosuggest based on input #2136

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fagiani
Copy link

@fagiani fagiani commented Mar 15, 2021

Description of the Change

This proposed change aims to resolve issue #2135 where a custom query can be made based on the input element
before the search fetch happens.

The change shouldn't impact any current users and will allow any new implementations to use a javascript function called window.epCustomQuery to return a modified version of the window.epas on the fly.

Alternate Designs

There were considered two alternatives to this PR:

  • Implementing within the esSearch function on the very top was considered because it would eventually benefit of the searchText length but it looked a bit offset as there was already a place where the queryJSON is defined.
  • Overriding window.fetch() to intercept the query but there would be no information about the input at that moment which would make it hard to achieve that goal.

Benefits

It will enable users to search using different inputs with different queries, including post types and other parameters.

Possible Drawbacks

A possible drawback is that a malformed query customization could lead to further errors down stream.

Verification Process

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

closes #2135

Changelog Entry

Allow query customization for autosuggest before fetching the search based on the input field.

@fagiani
Copy link
Author

fagiani commented Mar 17, 2021

@felipeelia I wasn't able to determine whether any of the errors reported on the checks are actually related to the code committed on this PR. I'd appreciate any insights on how to fix them. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autosuggest: Allow multiple input search fields with different queries for post types
1 participant