Skip to content

Most recent commit broke bulk indexing #196

@andrewtweber

Description

@andrewtweber

Commented here:
#148 (comment)

The last commit which merged PR #148 broke bulk indexing completely.

I'm pretty sure this is broken. You're calling chunk on a Collection, which does not take a callback argument. Only chunk on Query Builders takes a callback.

Collection method -> only argument is $size
Query Builder method -> takes both $size and $callback

Was this tested? The callback never gets entered, because it doesn't accept a callback as a parameter. At least when I've tried Model::addAllToIndex()

I also strongly disagree with implementing this in this way. If somebody wants to index all in one go, they should be able to, and damn the (lack of memory) consequences. If they want to chunk it, they can do that on their own. There's no need to chunk for them

Model::chunk(500, function (ElasticquentCollection $chunk) { $chunk->addToIndex(); });

^ that is what I was doing before, which this PR broke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions