- Issue created by @sabrina.liman
- 🇦🇹Austria drunken monkey Vienna, Austria
drunken monkey → made their first commit to this issue’s fork.
- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for reporting this issue!
However, I think the “minimum word length” option already works exactly as you describe: For minimum length 3 and input “st john” it will discard the “st” but keep “john” and not display any error message. The message will only be displayed if all words were removed that way (which makes sense since then the user will just see completely unrelated items from the index).
I think what might be happening is that you’re using Search API Autocomplete and, while you type, Javascript sent a request with just “st” as the keywords. The way Autocomplete works internally it seems like this would also trigger the form validation and even, confusingly, display the resulting error message on the next page load.
To check this, you can use XDebug to place a breakpoint on the relevant (i.e., second)$form_state->setErrorByName()
call inSearchApiFulltext::validateExposed()
and then see when that gets triggered.If this is indeed the cause of the problem for you, this would be a bug report for the Search API Autocomplete module. Feel free to move it accordingly. it does seem like a bad idea to display Views exposed form validation errors triggered during autocompletion. We might just want to call
\Drupal::messenger()->deleteAll()
after$view->build()
in\Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\search\Views::createQuery()
.