@@ -214,6 +214,73 @@ public static void testApplyViewBaseFilter() throws Exception {
214214 verifyMockViewService (mockService , TEST_VIEW_URN );
215215 }
216216
217+ @ Test
218+ public static void testFilterRemovesDuplicates () throws Exception {
219+ // Has no duplicate values
220+ Filter expectedFilter =
221+ new Filter ()
222+ .setOr (
223+ new ConjunctiveCriterionArray (
224+ new ConjunctiveCriterion ()
225+ .setAnd (
226+ new CriterionArray (
227+ ImmutableList .of (
228+ buildCriterion ("baseField" , Condition .EQUAL , "baseTest" ))))));
229+
230+ ViewService mockService = Mockito .mock (ViewService .class );
231+ EntityClient mockClient =
232+ initMockEntityClient (
233+ ImmutableList .of (Constants .DATASET_ENTITY_NAME ),
234+ "" ,
235+ expectedFilter ,
236+ 0 ,
237+ 10 ,
238+ new SearchResult ()
239+ .setEntities (new SearchEntityArray ())
240+ .setNumEntities (0 )
241+ .setFrom (0 )
242+ .setPageSize (0 )
243+ .setMetadata (new SearchResultMetadata ()));
244+
245+ final SearchAcrossEntitiesResolver resolver =
246+ new SearchAcrossEntitiesResolver (mockClient , mockService );
247+
248+ final SearchAcrossEntitiesInput testInput =
249+ new SearchAcrossEntitiesInput (
250+ ImmutableList .of (EntityType .DATASET ),
251+ "" ,
252+ 0 ,
253+ 10 ,
254+ null ,
255+ ImmutableList .of (
256+ new AndFilterInput (
257+ ImmutableList .of (
258+ new FacetFilterInput (
259+ "baseField" ,
260+ "" ,
261+ ImmutableList .of ("baseTest" , "baseTest" ),
262+ false ,
263+ FilterOperator .EQUAL )))),
264+ null ,
265+ null ,
266+ null );
267+ DataFetchingEnvironment mockEnv = Mockito .mock (DataFetchingEnvironment .class );
268+ QueryContext mockContext = getMockAllowContext ();
269+ Mockito .when (mockEnv .getArgument (Mockito .eq ("input" ))).thenReturn (testInput );
270+ Mockito .when (mockEnv .getContext ()).thenReturn (mockContext );
271+
272+ resolver .get (mockEnv ).get ();
273+
274+ verifyMockEntityClient (
275+ mockClient ,
276+ ImmutableList .of (
277+ Constants .DATASET_ENTITY_NAME ), // Verify that merged entity types were used.
278+ "" ,
279+ expectedFilter ,
280+ 0 ,
281+ 10 );
282+ }
283+
217284 @ Test
218285 public static void testApplyViewNullBaseEntityTypes () throws Exception {
219286 Filter viewFilter =
0 commit comments