Hi,

In the autocomplete, I have typed Drupal as a keyword but Drupal Keyword is not displaying in the autocomplete instead if I type next character it is displaying.

Comments

suresh.senthatti created an issue. See original summary.

suresh.senthatti’s picture

Version: 7.x-1.0-beta2 » 8.x-1.0-beta1
drunken monkey’s picture

Category: Bug report » Feature request
Issue tags: -autocomplete

This behavior is not defined by the Search API Autocomplete module, but up to each backend to implement (at least for the "Retrieve from server" suggester). So, which backend are you using? Please move this to the appropriate queue.
In any case, though: This behavior is there for a reason, it's not a bug. Some people feel that it doesn't make sense to suggest what the user has already typed. But we could make this behavior optional, I guess.

PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by module maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty.

hugronaphor’s picture

If I understand correctly @suresh.senthatti's needs, an easy option would be:

/**
 * Implements hook_search_api_autocomplete_suggestions_alter().
 *
 * {@inheritdoc}
 */
function hook_search_api_autocomplete_suggestions_alter(array &$suggestions, array $alter_params) {

  // Set the first suggestion identical as the User input.
  $newSuggestion = new Suggestion();
  $newSuggestion->setUserInput($alter_params['user_input']);
  array_unshift($suggestions, $newSuggestion);

}