Skip to content

Adding 'distinct' attribute at search time causing ApiException #724

Open
@whitespacecode

Description

@whitespacecode

Description
I'm using laravel scout to help me get a product list.
When building my search i wanted to provide a distinct attribute. i noticed meilisearch-php added that feature:
#648

Error:

Unknown field distinct: expected one of q, vector, offset, limit, 
page, hitsPerPage, attributesToRetrieve, attributesToCrop, cropLength, 
attributesToHighlight, showMatchesPosition, showRankingScore, showRankingScoreDetails, 
filter, sort, facets, highlightPreTag, highlightPostTag, cropMarker, matchingStrategy, attributesToSearchOn

Code is use to build the search query, when i want to add 'distinct' to the options i get the error.

Product::search($this->search)
    ->options([
        'filter' => $this->buildFilter(),
        'sort' => $this->buildSort(),
        'facets' => $this->buildFacets(),
        'limit' => $this->limit,
        // 'distinct' => $this->distinct, 
    ], fn ($value) => !is_null($value))
    ->$method(...$arguments);

I do notice the toArray() function in SearchQuery.php is missing distinct. Maybe that has something to do with it?

Environment (please complete the following information):

  • OS: [e.g. Debian GNU/Linux]
  • Meilisearch version: v1.12.3
  • meilisearch-php version: v1.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions