@@ -35,11 +35,14 @@ public function testGetIndexMapping()
3535
3636 $ this ->assertSame ([
3737 'properties ' => [
38- 'id ' => [
38+ 'object ' => [
3939 'type ' => 'long ' ,
4040 ],
41- 'type ' => [
42- 'type ' => 'keyword ' ,
41+ 'asset ' => [
42+ 'type ' => 'long ' ,
43+ ],
44+ 'document ' => [
45+ 'type ' => 'long ' ,
4346 ],
4447 ],
4548 ], $ adapter ->getIndexMapping ());
@@ -56,8 +59,7 @@ public function testNormalize()
5659 $ image ->setId (1 );
5760
5861 $ this ->assertSame ([
59- 'type ' => 'asset ' ,
60- 'id ' => 1 ,
62+ 'asset ' => [1 ],
6163 ], $ adapter ->normalize ($ image ));
6264 }
6365
@@ -118,7 +120,7 @@ public function testApplySearchFilter()
118120 'bool ' => [
119121 'filter ' => [
120122 'term ' => [
121- 'standard_fields.test.default.id ' => 1 ,
123+ 'standard_fields.test.default.asset ' => 1 ,
122124 ],
123125 ],
124126 ],
@@ -134,7 +136,7 @@ public function testApplySearchFilter()
134136 'bool ' => [
135137 'filter ' => [
136138 'term ' => [
137- 'standard_fields.test.en.id ' => 2 ,
139+ 'standard_fields.test.en.asset ' => 2 ,
138140 ],
139141 ],
140142 ],
@@ -150,7 +152,49 @@ public function testApplySearchFilter()
150152 'bool ' => [
151153 'filter ' => [
152154 'terms ' => [
153- 'standard_fields.test.en.id ' => [1 , 2 ],
155+ 'standard_fields.test.en.asset ' => [1 , 2 ],
156+ ],
157+ ],
158+ ],
159+ ],
160+ ], $ search ->toArray ());
161+
162+ $ searchIndexConfigServiceInterfaceMock = $ this ->makeEmpty (SearchIndexConfigServiceInterface::class);
163+ $ adapter = (new RelationAdapter (
164+ $ searchIndexConfigServiceInterfaceMock ,
165+ ))->setType ('object ' );
166+
167+ $ filter = new AssetMetaDataFilter ('test ' , 'object ' , 1 );
168+ $ search = new Search ();
169+ $ adapter ->applySearchFilter ($ filter , $ search );
170+
171+ $ this ->assertSame ([
172+ 'query ' => [
173+ 'bool ' => [
174+ 'filter ' => [
175+ 'term ' => [
176+ 'standard_fields.test.default.object ' => 1 ,
177+ ],
178+ ],
179+ ],
180+ ],
181+ ], $ search ->toArray ());
182+
183+ $ searchIndexConfigServiceInterfaceMock = $ this ->makeEmpty (SearchIndexConfigServiceInterface::class);
184+ $ adapter = (new RelationAdapter (
185+ $ searchIndexConfigServiceInterfaceMock ,
186+ ))->setType ('document ' );
187+
188+ $ filter = new AssetMetaDataFilter ('test ' , 'document ' , 1 );
189+ $ search = new Search ();
190+ $ adapter ->applySearchFilter ($ filter , $ search );
191+
192+ $ this ->assertSame ([
193+ 'query ' => [
194+ 'bool ' => [
195+ 'filter ' => [
196+ 'term ' => [
197+ 'standard_fields.test.default.document ' => 1 ,
154198 ],
155199 ],
156200 ],
0 commit comments