jackkitley's avatar

Laravel Scout with Typesense and query with

When using the search method and paginate for my data, data is returned correctly with correct total number of records.

When i include the query method then i get 1 page of data and an incorrect total count.

        return $this->model->search($search)
            ->query(fn(Builder $query) => $query->with('mainListingImage'))
            ->options([
                'query_by' => 'vehicle_description, transmission, fuel_type, colour'
            ])
            ->paginate(12)->withQueryString();

The above gives me one page of data with 12 records.

If i remove ->query() then it gives me 1688 records with paging.

0 likes
0 replies

Please or to participate in this conversation.