Sphinx and Yii2 how to set limit?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
33 views
Please tell me there is the following code:
public function search() { $this->load($this->searchParams); $query = new Query(); $items = $query->from('news') ->match($this->query) ->orderBy(['date_added' => SORT_DESC]) ->all(); $items = array_column($items,'id'); $query = News::find() ->where(['in', 'id', $items]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => false, 'pagination' => [ 'pageSize' => 15 ] ]); return $dataProvider; }

  1. Whether I'm working with sphinx? I send him a search query, get an array of IDs and make them a sample.
  2. How to work with limit from sphinx? Returns only 20 records... to the current page and count based on the number of items per page?
  3. Or with sphinx I need to obtain not only the id? a full volume of data and pass them into the DataProvider?

Thanks in advance.
by | 33 views

2 Answers

0 like 0 dislike
The fact that in the view I'm working with a news object and use its methods.
by
0 like 0 dislike
From sphinx2 have the option max_matches , it is necessary to increase to the desired result, for example, 1000 to deliver.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked Jun 10, 2019 by alex_maldinsky
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,015 users