| @@ 556-569 (lines=14) @@ | ||
| 553 | ); |
|
| 554 | } |
|
| 555 | ||
| 556 | public function testContentTypeIdFilter() |
|
| 557 | { |
|
| 558 | $this->assertSearchResults( |
|
| 559 | [10, 14, 226], |
|
| 560 | $this->getContentSearchHandler()->findContent( |
|
| 561 | new Query( |
|
| 562 | [ |
|
| 563 | 'filter' => new Criterion\ContentTypeId(4), |
|
| 564 | 'limit' => 10, |
|
| 565 | ] |
|
| 566 | ) |
|
| 567 | ) |
|
| 568 | ); |
|
| 569 | } |
|
| 570 | ||
| 571 | public function testContentTypeIdentifierFilter() |
|
| 572 | { |
|
| @@ 944-957 (lines=14) @@ | ||
| 941 | ); |
|
| 942 | } |
|
| 943 | ||
| 944 | public function testFullTextFilter() |
|
| 945 | { |
|
| 946 | $this->assertSearchResults( |
|
| 947 | [191], |
|
| 948 | $this->getContentSearchHandler()->findContent( |
|
| 949 | new Query( |
|
| 950 | [ |
|
| 951 | 'filter' => new Criterion\FullText('applied webpage'), |
|
| 952 | 'limit' => 10, |
|
| 953 | ] |
|
| 954 | ) |
|
| 955 | ) |
|
| 956 | ); |
|
| 957 | } |
|
| 958 | ||
| 959 | public function testFullTextWildcardFilter() |
|
| 960 | { |
|
| @@ 959-972 (lines=14) @@ | ||
| 956 | ); |
|
| 957 | } |
|
| 958 | ||
| 959 | public function testFullTextWildcardFilter() |
|
| 960 | { |
|
| 961 | $this->assertSearchResults( |
|
| 962 | [191], |
|
| 963 | $this->getContentSearchHandler()->findContent( |
|
| 964 | new Query( |
|
| 965 | [ |
|
| 966 | 'filter' => new Criterion\FullText('applie*'), |
|
| 967 | 'limit' => 10, |
|
| 968 | ] |
|
| 969 | ) |
|
| 970 | ) |
|
| 971 | ); |
|
| 972 | } |
|
| 973 | ||
| 974 | public function testFullTextDisabledWildcardFilter() |
|
| 975 | { |
|
| @@ 974-989 (lines=16) @@ | ||
| 971 | ); |
|
| 972 | } |
|
| 973 | ||
| 974 | public function testFullTextDisabledWildcardFilter() |
|
| 975 | { |
|
| 976 | $this->assertSearchResults( |
|
| 977 | [], |
|
| 978 | $this->getContentSearchHandler( |
|
| 979 | ['enableWildcards' => false] |
|
| 980 | )->findContent( |
|
| 981 | new Query( |
|
| 982 | [ |
|
| 983 | 'filter' => new Criterion\FullText('applie*'), |
|
| 984 | 'limit' => 10, |
|
| 985 | ] |
|
| 986 | ) |
|
| 987 | ) |
|
| 988 | ); |
|
| 989 | } |
|
| 990 | ||
| 991 | public function testFullTextFilterStopwordRemoval() |
|
| 992 | { |
|
| @@ 991-1010 (lines=20) @@ | ||
| 988 | ); |
|
| 989 | } |
|
| 990 | ||
| 991 | public function testFullTextFilterStopwordRemoval() |
|
| 992 | { |
|
| 993 | $handler = $this->getContentSearchHandler( |
|
| 994 | [ |
|
| 995 | 'stopWordThresholdFactor' => 0.1, |
|
| 996 | ] |
|
| 997 | ); |
|
| 998 | ||
| 999 | $this->assertSearchResults( |
|
| 1000 | [], |
|
| 1001 | $handler->findContent( |
|
| 1002 | new Query( |
|
| 1003 | [ |
|
| 1004 | 'filter' => new Criterion\FullText('the'), |
|
| 1005 | 'limit' => 10, |
|
| 1006 | ] |
|
| 1007 | ) |
|
| 1008 | ) |
|
| 1009 | ); |
|
| 1010 | } |
|
| 1011 | ||
| 1012 | public function testFullTextFilterNoStopwordRemoval() |
|
| 1013 | { |
|
| @@ 821-838 (lines=18) @@ | ||
| 818 | ); |
|
| 819 | } |
|
| 820 | ||
| 821 | public function testFieldFilterIn() |
|
| 822 | { |
|
| 823 | $this->assertSearchResults( |
|
| 824 | [11, 42], |
|
| 825 | $this->getContentSearchHandler()->findContent( |
|
| 826 | new Query( |
|
| 827 | [ |
|
| 828 | 'filter' => new Criterion\Field( |
|
| 829 | 'name', |
|
| 830 | Criterion\Operator::IN, |
|
| 831 | ['members', 'anonymous users'] |
|
| 832 | ), |
|
| 833 | 'limit' => 10, |
|
| 834 | ] |
|
| 835 | ) |
|
| 836 | ) |
|
| 837 | ); |
|
| 838 | } |
|
| 839 | ||
| 840 | public function testFieldFilterContainsPartial() |
|
| 841 | { |
|
| @@ 897-914 (lines=18) @@ | ||
| 894 | ); |
|
| 895 | } |
|
| 896 | ||
| 897 | public function testFieldFilterBetween() |
|
| 898 | { |
|
| 899 | $this->assertSearchResults( |
|
| 900 | [186, 187], |
|
| 901 | $this->getContentSearchHandler()->findContent( |
|
| 902 | new Query( |
|
| 903 | [ |
|
| 904 | 'filter' => new Criterion\Field( |
|
| 905 | 'publication_date', |
|
| 906 | Criterion\Operator::BETWEEN, |
|
| 907 | [1190000000, 1200000000] |
|
| 908 | ), |
|
| 909 | 'limit' => 10, |
|
| 910 | ] |
|
| 911 | ) |
|
| 912 | ) |
|
| 913 | ); |
|
| 914 | } |
|
| 915 | ||
| 916 | public function testFieldFilterOr() |
|
| 917 | { |
|
| @@ 1378-1395 (lines=18) @@ | ||
| 1375 | ); |
|
| 1376 | } |
|
| 1377 | ||
| 1378 | public function testFieldFilterBetween() |
|
| 1379 | { |
|
| 1380 | $this->assertSearchResults( |
|
| 1381 | [188, 189], |
|
| 1382 | $this->getContentSearchHandler()->findLocations( |
|
| 1383 | new LocationQuery( |
|
| 1384 | [ |
|
| 1385 | 'filter' => new Criterion\Field( |
|
| 1386 | 'publication_date', |
|
| 1387 | Criterion\Operator::BETWEEN, |
|
| 1388 | [1190000000, 1200000000] |
|
| 1389 | ), |
|
| 1390 | 'limit' => 10, |
|
| 1391 | ] |
|
| 1392 | ) |
|
| 1393 | ) |
|
| 1394 | ); |
|
| 1395 | } |
|
| 1396 | ||
| 1397 | public function testFieldFilterOr() |
|
| 1398 | { |
|