laravel-scout-typesense-driver icon indicating copy to clipboard operation
laravel-scout-typesense-driver copied to clipboard

Duplicate array keys in TypesenseEngine::buildSearchParams

Open olexin-pro opened this issue 1 year ago • 1 comments
trafficstars

Description

Keys are repeated: q, query_by, filter_by, per_page, page, highlight_start_tag, highlight_end_tag, exhaustive_search in TypesenseEngine::buildSearchParams on line 230

    private function buildSearchParams(Builder $builder, int $page, int|null $perPage): array
    {
        $params = [
            'q' => $builder->query,
            'query_by' => implode(',', $builder->model->typesenseQueryBy()),
            'filter_by' => $this->filters($builder),
            'per_page' => $perPage,
            'page' => $page,
            'highlight_start_tag' => $this->startTag,
            'highlight_end_tag' => $this->endTag,
            'exhaustive_search' => $this->exhaustiveSearch,
            'q'                          => $builder->query,
            'query_by'                   => implode(',', $builder->model->typesenseQueryBy()),
            'filter_by'                  => $this->filters($builder),
            'per_page'                   => $perPage,
            'page'                       => $page,
            'highlight_start_tag'        => $this->startTag,
            'highlight_end_tag'          => $this->endTag,
            'snippet_threshold'          => $this->snippetThreshold,
            'exhaustive_search'          => $this->exhaustiveSearch,
            'use_cache'                  => $this->useCache,
            'cache_ttl'                  => $this->cacheTtl,
            'prioritize_exact_match'     => $this->prioritizeExactMatch,
            'enable_overrides'           => $this->enableOverrides,
            'highlight_affix_num_tokens' => $this->highlightAffixNumTokens,
        ];

       // etc...

}

Metadata

Typesense Version:0.25.2 laravel-scout-typesense-driver: 5.2.8

OS: Docker

olexin-pro avatar Jan 20 '24 13:01 olexin-pro

already fixed in #74

aou24 avatar Apr 18 '24 17:04 aou24