@@ -40,7 +40,6 @@ class SearchQuery implements SortableQuery, CollapsibleQuery, HighlightingQuery
4040 protected ?int $ from = null ;
4141 protected array $ fields = [];
4242 protected array $ include = [];
43- protected ?array $ pinnedIds = null ;
4443 protected array $ exclude = [];
4544 protected ?string $ searchType = null ;
4645
@@ -150,19 +149,12 @@ protected function execute(
150149 $ dsl = [
151150 'size ' => $ size ,
152151 'from ' => $ from ,
153- 'query ' => [] ,
152+ 'query ' => $ this -> boolQuery -> toDSL () ,
154153 'track_total_hits ' => $ totals ,
155154 '_source ' => $ this ->sourceToDSL ($ source ),
156155 'fields ' => $ source && $ this ->fields ? $ this ->fields : null ,
157156 ];
158157
159- if ($ this ->pinnedIds ) {
160- $ dsl ['query ' ]['pinned ' ]['ids ' ] = $ this ->pinnedIds ;
161- $ dsl ['query ' ]['pinned ' ]['organic ' ] = $ this ->boolQuery ->toDSL ();
162- } else {
163- $ dsl ['query ' ] = $ this ->boolQuery ->toDSL ();
164- }
165-
166158 $ sorts ??= $ this ->sorts ;
167159 if (!$ sorts ->isEmpty ()) {
168160 $ dsl ['sort ' ] = $ sorts ->toDSL ();
@@ -253,13 +245,6 @@ public function setPostFilter(BoolQueryBuilder $boolQueryBuilder): static
253245 return $ this ;
254246 }
255247
256- public function pinned (array $ ids ): static
257- {
258- $ this ->pinnedIds = $ ids ;
259-
260- return $ this ;
261- }
262-
263248 public function addAggregations (Aggregation $ aggregation ): static
264249 {
265250 $ this ->aggregations ??= new AggregationCollection ();
0 commit comments