Skip to content

Commit

Permalink
Fix broken publication status update
Browse files Browse the repository at this point in the history
Add missing document type to partialUpdate in arElasticSearchPlugin
  • Loading branch information
anvit committed Oct 21, 2024
1 parent 7ed6e6b commit 426515a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
* along with Access to Memory (AtoM). If not, see <http://www.gnu.org/licenses/>.
*/

use Elastica\Query;
use Elastica\Response;
use Elastica\Script\AbstractScript;
use Elasticsearch\Endpoints\UpdateByQuery;

class arElasticSearchIndexDecorator
{
protected $_instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,13 @@ public function partialUpdate($object, $data)
return;
}

$type = get_class($object);

$document = new \Elastica\Document($object->id, $data);
$document->setType($this->index->getIndexTypeName($type));

try {
$this->index->getType(get_class($object))->updateDocuments([$document]);
$this->index->getType($type)->updateDocuments([$document]);
} catch (\Elastica\Exception\NotFoundException $e) {
// Create document if it's not found
$this->update($object);
Expand Down

0 comments on commit 426515a

Please sign in to comment.