summaryrefslogtreecommitdiff
path: root/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-22 11:38:59 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-23 13:22:40 +0300
commita529a40ec8569a7010df4965c4e7fff9e81eb125 (patch)
treea41f533085c735de921db4e98c4097e086bda070 /src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
parent13ca7a3fdb812467b57c6c4d33e13f69cf3cdcc3 (diff)
downloadphorge-elasticsearch-modern-a529a40ec8569a7010df4965c4e7fff9e81eb125.tar.gz
phorge-elasticsearch-modern-a529a40ec8569a7010df4965c4e7fff9e81eb125.zip
Engine: Add buildTypeFilter() helper (body-level documentType filter)
🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php')
-rw-r--r--src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
index 1762d32..95558a1 100644
--- a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
+++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
@@ -89,4 +89,29 @@ final class VyOSElasticModernFulltextStorageEngineTestCase
$this->assertEqual('/_search', $engine->getSearchUri(array()));
}
+ public function testBuildTypeFilter() {
+ $engine = id(new VyOSElasticModernFulltextStorageEngine())
+ ->setVersion(7);
+ $filter = $engine->buildTypeFilter(array('TASK', 'DREV'));
+ $expected = array(
+ 'terms' => array(
+ 'documentType' => array('TASK', 'DREV'),
+ ),
+ );
+ $this->assertEqual($expected, $filter);
+ }
+
+ public function testBuildTypeFilterEmpty() {
+ // Empty list still produces a filter; the caller is responsible
+ // for normalizing "no types specified" to "all indexable types"
+ // before calling this method. This matches the bundled engine's
+ // pattern (executeSearch() normalizes before URL construction).
+ $engine = id(new VyOSElasticModernFulltextStorageEngine())
+ ->setVersion(7);
+ $filter = $engine->buildTypeFilter(array());
+ $this->assertEqual(
+ array('terms' => array('documentType' => array())),
+ $filter);
+ }
+
}