When executing all tasks with Drush (drush sapi-et), the drush_search_api_execute_tasks() function is called with NULL as the server ID. However, it seems we never tested this properly and it runs into several errors.

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new1.34 KB
meyerrob’s picture

That patch solves the divison by null error for me after calling drush sapi-et

The question is: Why is the number of tasks 0?

The table search_api_task is always empty, even after I cleared the index with drush sapi-c - and there should be at least one task to do after that ("indexing"). As there ist no entry in search_api_task the command drush sapi-et does not do anything. The call of drush sapi-i builts the index correctly.

Therefore it seems as if the entry in search_api_task is not properly filled, but right now I am running out of debugging time. I stumbled over this topic through another issue - normally I use the GUI to reindex my search index which works perfectly. Therefore maybe I just misunderstood the drush sapi-et...

  • drunken monkey committed d44c1b6c on 7.x-1.x
    Issue #3339336 by drunken monkey, meyerrob: Fixed Drush bug when...
drunken monkey’s picture

Status: Needs review » Fixed

Thanks a lot for testing and reporting back, good to hear that this works as intended.
Committed.

Your confusion regarding the search_api_task table seems to come from a misunderstanding about that table’s contents. It doesn’t pertain at all to items that need to be indexed – that’s what search_api_item is for. “Tasks”, in the Search API, refer to changes that still need to be executed. I now added a more detailed explanation to Glossary doc page – please comment there in case this is unclear, or you have suggestions regarding the phrasing to make it easier to understand. (Or, of course, feel free to edit it right away.)

Anyways, thanks again!

Status: Fixed » Closed (fixed)

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

caesius’s picture

So, a few things:

1. The 7.x-1.x-dev version of the module listed on the project page was built 5 March 2022 even though the commit log shows 4 commits since then. https://git.drupalcode.org/project/search_api/-/commits/7.x-1.x

2. Git cloning the project and plopping it onto a site completely breaks Drush with this error:

$ ddev drush updb -y
PHP Fatal error:  Uncaught Error: Class "view" not found in /var/www/html/web/sites/all/modules/contrib/search_api/search_api.drush.inc:731

It seems the commit for this issue added a bunch of unrelated code for a view? It wasn't in the patch in #2. https://git.drupalcode.org/project/search_api/-/commit/d44c1b6cd8813ab39...