File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -681,6 +681,23 @@ public function testGetDocumentsWithSort(): void
681
681
self ::assertSame (1344 , $ response [0 ]['id ' ]);
682
682
}
683
683
684
+ public function testGetDocumentsWithFiltersFieldsAndSort (): void
685
+ {
686
+ $ index = $ this ->createEmptyIndex ($ this ->safeIndexName ('movies ' ));
687
+ $ index ->updateSortableAttributes (['id ' , 'genre ' ]);
688
+ $ index ->updateFilterableAttributes (['id ' , 'genre ' ]);
689
+ $ promise = $ index ->addDocuments (self ::DOCUMENTS );
690
+ $ index ->waitForTask ($ promise ['taskUid ' ]);
691
+
692
+ $ query = (new DocumentsQuery ())
693
+ ->setSort (['genre:desc ' , 'id:asc ' ])
694
+ ->setFields (['id ' , 'title ' ])
695
+ ->setFilter (['id > 2 ' ]);
696
+ $ response = $ index ->getDocuments ($ query );
697
+ self ::assertSame (123 , $ response [0 ]['id ' ]);
698
+ self ::assertSame (['id ' , 'title ' ], array_keys ($ response [0 ]));
699
+ }
700
+
684
701
public function testGetDocumentsWithFilterCorrectFieldFormat (): void
685
702
{
686
703
$ fields = ['the ' , 'clash ' ];
You can’t perform that action at this time.
0 commit comments