Problem/Motivation

The current module does not integrate SearchStax's Auto-Suggest Capabilities. SearchStax has an Auto-suggest API and when using the module user should have the ability to use that API.

Steps to reproduce

Proposed resolution

By default, the module should use the AutoSuggest APIs.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork searchstax-3232023

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

maggon created an issue. See original summary.

drunken monkey’s picture

This module already integrates with Search API Autocomplete, which is the main means of adding auto-suggest to Search API searches. When this module is installed, the user just needs to select “SearchStax” as the suggester for an autocomplete search and autocompletion will start using SearchStax’s Auto-Suggest under the hood.
See the “Add auto-suggest to your searches (optional)” section of the documentation.

Adding autocomplete capabilities directly to this module would just mean duplicating lots of code between the two modules or severly restricting usability.

pavlosdan made their first commit to this issue’s fork.

pavlosdan’s picture

Version: 1.2.0 » 1.x-dev
Component: Code » Documentation
Category: Feature request » Task
Priority: Major » Normal
Status: Active » Needs review

Since the auto-suggest core field is wrapped in an if module exists:

  if (\Drupal::moduleHandler()->moduleExists('search_api_autocomplete')) {
      $form['autosuggest_core'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Auto-suggest core'),
        '#description' => $this->t('The “core” part of your SearchStudio auto-suggest URL. This is the second-to-last part of the URL, between “solr” and “emsuggest”: [DOMAIN]/solr/[CORE]/emsuggest. (Only needed if you want to use auto-suggest.)'),
        '#config_target' => 'searchstax.settings:autosuggest_core',
      ];
    }

it is not immediately apparent to the user that the SearchStax auto-suggest feature is supported. It's also not documented on the module's page. The only way for someone to see right now that this is supported is to delve into the issue queue or read the module's code.

Added a README file to document the feature.

Could we also consider whether wrapping the field is needed? Since it's not a required field would it cause any issues if it's present on the form but left empty?

drunken monkey’s picture

Good idea to add a README.md file, thanks! I expanded it slightly and amended the code style.
Also, you’re right, this might currently be not discoverable enough for people unfamiliar with the Search API ecosystem. In your MR, I’m now changing the settings form to always display the “Auto-suggest core” field but disable it if the Search API Autocomplete module is not installed (along with an explanation to install it).
What do you say, do these changes make sense to you?

pavlosdan’s picture

Status: Needs review » Reviewed & tested by the community

Changes make sense to me! Also liking the idea of having the field present on the form with a prompt to install search_api_autocomplete for it to become active rather than having it completely hidden :)

Thanks for addressing the coding standards issue. Sorry about that!

Looks good to me. Setting it to reviewed and tested.

Another question I had was whether this setting (and maybe others?) would be better served as part of the search_api server and search_api_autocomplete settings. As it stands, this configures SearchStax globally with one auto suggest core but a Drupal site may have multiple connect SearchStax cores (especially if multi-tenant) so we'd need to be able to point each SearchStax server's autocomplete settings to the appropriate emsuggest core. What do you think about having another issue to explore moving some settings to the search_api and search_api_autocomplete configuration entities?

john.oltman’s picture

I created https://www.drupal.org/project/searchstax/issues/3551333 and plan to work on that over the next few weeks unless someone beats me to it.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks again!
Merged.

I’ll look at the other issue soon, too.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.