MDL-68776 search: remove support for optional add_documents return.

All six returned array elements must now be present.
This commit is contained in:
Paul Holden 2023-02-10 10:41:50 +00:00
parent 0780e87f06
commit 5021b3a5b5
2 changed files with 7 additions and 20 deletions

View File

@ -1289,15 +1289,8 @@ class manager {
if ($batches !== $numdocs + $numdocsignored) {
$batchinfo = ' (' . $batches . ' batch' . ($batches === 1 ? '' : 'es') . ')';
}
} else if (count($result) === 5) {
// Backward compatibility for engines that don't return a batch count.
[$numrecords, $numdocs, $numdocsignored, $lastindexeddoc, $partial] = $result;
// Deprecated since Moodle 3.10 MDL-68690.
// TODO: MDL-68776 This will be deleted in Moodle 4.2.
debugging('engine::add_documents() should return $batches (5-value return is deprecated)',
DEBUG_DEVELOPER);
} else {
throw new coding_exception('engine::add_documents() should return $partial (4-value return is deprecated)');
throw new \coding_exception('engine::add_documents() should return 6 values');
}
if ($numdocs > 0) {
@ -1454,19 +1447,8 @@ class manager {
if ($batches !== $numdocs + $numdocsignored) {
$batchinfo = ' (' . $batches . ' batch' . ($batches === 1 ? '' : 'es') . ')';
}
} else if (count($result) === 5) {
// Backward compatibility for engines that don't return a batch count.
[$numrecords, $numdocs, $numdocsignored, $lastindexeddoc, $partial] = $result;
// Deprecated since Moodle 3.10 MDL-68690.
// TODO: MDL-68776 This will be deleted in Moodle 4.2 (as should the below bit).
debugging('engine::add_documents() should return $batches (5-value return is deprecated)',
DEBUG_DEVELOPER);
} else {
// Backward compatibility for engines that don't support partial adding.
list($numrecords, $numdocs, $numdocsignored, $lastindexeddoc) = $result;
debugging('engine::add_documents() should return $partial (4-value return is deprecated)',
DEBUG_DEVELOPER);
$partial = false;
throw new \coding_exception('engine::add_documents() should return 6 values');
}
if ($numdocs > 0) {

View File

@ -1,6 +1,11 @@
This files describes API changes in /search/*,
information provided here is intended especially for developers.
=== 4.2 ===
* Support for optional final element returned by engine `add_documents()` implementations is now removed, all
six expected returned array elements must be present
=== 3.10 ===
* Search indexing now supports sending multiple documents to the server in a batch. This is implemented