Hi,

Could you please add new drush commands to enable/disable configured servers? Right now it is only possible to enable/disable index.

Thanks,
Yohan.

Comments

rosinegrean’s picture

Hey,

@drunken monkey should confirm if this will be added or not in the module, but i can create a patch for this if he confirmes. And maybe add them to D8 version also.

drunken monkey’s picture

Sure, why not, if you think it's useful enough.
Personally, I'd not see that many use cases where you'd want to do this, but if you provide a patch, sure. (Also, big plus point for already mentioning D8, it should definitely be added there, too!)

rosinegrean’s picture

Assigned: Unassigned » rosinegrean

If you can do it from back end, it might be useful to do it from Drush too.

I saw this comment
// @todo: Maybe add logic to print table of all servers.
in search_api_drush_get_server()

It might be a good idea to add a drush command to list the servers first, then to en/dis one of them.
I'll give it a try and let you know.
Thanks,

rosinegrean’s picture

Status: Active » Needs review
StatusFileSize
new3.71 KB

I've added 3 new drush commands:
- sapi-sl for listing all the servers
- sapi-se for enabling a specified server
- sapi-sd for disabling a specified server

I'll wait for your input on this.
Thanks,

rosinegrean’s picture

StatusFileSize
new3.57 KB
new476 bytes

Hello,

I've cleaned a little the patch.
Also the patch for the D8 version is already ready, just waiting for your input.
Thanks,

drunken monkey’s picture

StatusFileSize
new3.87 KB
new3.41 KB

Thanks a lot, good job!
There were a few minor code style issues, but other than that it looks good.
Please verify the attached patch still works for you, then I can commit it.

rosinegrean’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @drunken monkey
The patch still works.

  • drunken monkey committed 2ac29dc on 7.x-1.x authored by prics
    Issue #2479453 by prics, drunken monkey: Added a Drush command to list/...
drunken monkey’s picture

Version: 7.x-1.14 » 8.x-1.x-dev
Component: Framework » Drush / Rules
Status: Reviewed & tested by the community » Patch (to be ported)

OK, great to hear!
Committed.
Thanks again!

You said you already have a patch for D8, too? That would of course be excellent, please post!

rosinegrean’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new3.51 KB

Yes, here it is.

I've followed the style from your patch for D7, hope it's all good.
Thanks,

  • drunken monkey committed 1924032 on 8.x-1.x authored by prics
    Issue #2479453 by prics, drunken monkey: Added a Drush command to list/...
drunken monkey’s picture

Status: Needs review » Fixed

Thanks a lot, looks good already!
Just two minor things:

  1. +++ b/search_api.drush.inc
    @@ -517,3 +551,74 @@ function drush_search_api_search($index_id, $keyword) {
    + * List all the servers.
    

    The first lines of doc comments should start with a verb in third person.

  2. +++ b/search_api.drush.inc
    @@ -517,3 +551,74 @@ function drush_search_api_search($index_id, $keyword) {
    + * @param int|string $server_id
    + *   The numeric ID or machine name of the server to enable.
    

    In D8, there is no numeric ID anymore, there's just the "ID" (which is the previous "machine name").

Other than that it was great, so I just corrected those (and some phrasing) and then committed.
Thanks again!

Status: Fixed » Closed (fixed)

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

yohanaraujo07@gmail.com’s picture

Hi I wasn't aware of the issue crediting by the time I opened the ticket, can you please attribute the credit? Thanks!!

yohanaraujo07@gmail.com’s picture