Skip to content

Several small issues #7

Open
Open
@willvincent

Description

@willvincent
  1. Many tests are reporting as risky with no assertions - it looks like newer version of mockery & phpunit don't reliably treat shouldReceive as an assertion, unless you specify the number of times it should be expected.

  2. The scout syntax for adding extra conditions via a queryCallback is ignored when building the query:

    // Proper syntax for adding (for instance) a where clause with a scout query:
    User::search($search_term)
        ->query(function ($builder) {
            $builder->where('created_at', '<', '2025-01-01');
        })
        ->get();
    
    // Resulting query is missing the where clause.
    // However this works:
    User::search($search_term)->where('created_at', '<', '2025-01-01')->get();

    Arguably nicer syntax, but should also support the official scout api with a quaryCallback.

  3. Only where queries are supported, ideally should also support whereIn() and whereNotIn(), both of which are available on the Laravel\Scout\Builder::class

  4. Soft delete support is not properly handled. If soft_delete is enabled in the scout config, the query incorrectly gets a where('__soft_deleted', '=', 0) clause added (by scout internals). Instead we need to replace that clause if it's present with an appropriate whereNull()/whereNotNull() on the softDelete column for the model. This way we can properly handle regular queries, withTrashed and onlyTrashed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions