Problem/Motivation

The current implementation puts the auto suggest core URL in global settings, limiting websites to one autocomplete for the entire site. As noted in the docs on the Search Stax side, auto suggest is a per-app feature, so the suggester URL should be with the index update endpoint URL and read/write token in the server config.

Steps to reproduce

Try to implement more than one autocomplete.

Proposed resolution

Move the suggester URL config from global settings to the server. Update the necessary PHP code to use the new location and ensure a site can have multiple (different) autocompletes. Use an update hook to transfer the global setting to a search API server for existing installs of the module.

Issue fork searchstax-3551333

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

john.oltman created an issue. See original summary.

john.oltman’s picture

Issue summary: View changes
pavlosdan’s picture

We'll probably need an upgrade path once the config is moved as well for existing sites.

john.oltman’s picture

Yes, the challenge there is for a site with multiple Drupal search stax servers, which server should the update hook move the global settings into. Maybe I keep the global setting and simply add the per-server config. And the global is only used as a fallback if a suggest URL is not defined in the server yet.

john.oltman’s picture

For a new install of the module, or for an existing site with one Drupal search stax server (so I can do the move), the global setting would be hidden.

pavlosdan’s picture

Unless I'm mistaken the suggester core ID it's just the Core ID from the "select" or "update" endpoints suffixed with "_suggester". Could we check the string and move the suggester core to whichever Search API server is configured with the expected SearchStax core?

john.oltman’s picture

Good call - you are correct - I can determine which server it belongs to from the url. So the update hook can always do the move. Scratch what I said about keeping the global setting. Thanks @pavlosdan!

john.oltman’s picture

Issue summary: View changes
drunken monkey’s picture

Discussed with John directly, I’m taking over. I hope to have something early next week.

drunken monkey’s picture

Status: Active » Needs work

I have something working now in this draft MR which can already be tested in case anyone is interested.
It’s still missing the update hook and test coverage (probably also test adaptions, so I expect failures there), but the basic functionality should be there. Just make sure to manually set the new auto-suggest core setting on all servers, then you should be able to use autocomplete with all of them.
There is also a change record, feedback on that would be also welcome.

I should be able to complete the missing pieces by the end of the week, or possibly already tomorrow – but thought I’d share what I have right away in case someone has feedback on the basic direction.

drunken monkey’s picture

Status: Needs work » Needs review

I added the update hook and adapted the existing test. Not sure if any more test coverage is really needed – potentially for the update hook, but that’s not very complex (and a pain to test).
In any case, feel free to already give this a try or review my code.

john.oltman’s picture

Status: Needs review » Needs work

Thank you - there are test failures related to the number of parameters being passed to a constructor - can you fix those and then I'll give this a try.

john.oltman’s picture

Also I am curious why the MR does not show up here on the issue page, now that you took it out of Draft. But I can reach it from the link you gave me.

drunken monkey’s picture

Status: Needs work » Needs review

Should now all be fixed and I also added an update test.
Please test/review.

And yes, very strange that the MR is not linked. It’s also not linked from the contribution record. Seems like something went wrong there.
Anyways, should not really hamper us.

john.oltman changed the visibility of the branch 3551333-move-auto-suggest to hidden.

john.oltman changed the visibility of the branch 3551333-move-auto-suggest to active.

john.oltman’s picture

This worked great for me in my test, the autosuggest core was copied to the appropriate server by the update hook and I manually removed the global setting after it completed. I then tested my autocomplete and it was still working. So a completely seamless experience. Fantastic.

I did have a couple of questions I left on the MR, one relating to the new legacy form alter hook and one relating to why the global setting was not removed by the update hook. Overall this is really great, very high quality work. Thank you!

drunken monkey’s picture

Assigned: drunken monkey » Unassigned

Thanks a lot for trying it out, good to hear it worked, and also for reviewing the MR so thoroughly!
I hope I could answer all your questions there, please tell me if you now think the update function’s behavior makes sense or if you would like to change it.

john.oltman’s picture

Status: Needs review » Reviewed & tested by the community

Your answers all make sense and I think this is good to go. Also, I see why the MR is not showing up here, your branch is on the main repo instead of the issue fork. If it's easy to move the branch and update the existing MR to point to it without losing the MR comments and history, then I advise that - otherwise skip it. Thanks again.

  • drunken monkey committed d85cf4cd on 1.x
    [#3551333] feat: Moved auto-suggest URL from global settings to server...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Ah, you’re right, thanks for figuring that out! No idea, how it happened, though. Guess I’ll just have to pay closer attention in the future.
Unfortunately, it doesn’t seem to be possible to change the source branch of a merge request, so we’re stuck with this. Sorry.

Anyways, thanks a lot for your help and feedback, this is now merged.
Thanks again, everyone!

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

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

Maintainers, credit people who helped resolve this issue.

john.oltman’s picture

@drunken_monkey do you have a timetable for a new release of the module. Look forward to making use of this!

drunken monkey’s picture

The recently merged MRs are currently being tested, once QA give us their blessing I’ll create a new release.

Status: Fixed » Closed (fixed)

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

john.oltman’s picture

This was not part of the recent 1.8.2 release, which is somewhat confusing since it was merged into the dev branch and the issue was closed prior to release 1.8.2. Is QA still testing it?

drunken monkey’s picture

Yes, this is still being tested by QA. Sorry for the delay!
It will be part of the upcoming 1.9.0 release, hopefully next week.