@GetMapping("/apps/search/by-appid-or-name")
  public PageDTO<App> search(@RequestParam(value = "query", required = false) String query, Pageable pageable) {
    if (StringUtils.isEmpty(query)) {
      return appService.findAll(pageable);
    }

    //search app
    PageDTO<App> appPageDTO = appService.searchByAppIdOrAppName(query, pageable);
    if (appPageDTO.hasContent()) {
      return appPageDTO;
    }

    if (!portalConfig.supportSearchByItem()) {
      return new PageDTO<>(Lists.newLinkedList(), pageable, 0);
    }

    //search item
    return searchByItem(query, pageable);
  }
@Test
  public void testSearchItemSwitch() {
    String query = "timeout";
    PageRequest request = PageRequest.of(0, 20);

    PageDTO<App> apps = new PageDTO<>(Lists.newLinkedList(), request, 0);

    when(appService.searchByAppIdOrAppName(query, request)).thenReturn(apps);
    when(portalConfig.supportSearchByItem()).thenReturn(false);

    PageDTO<App> result = searchController.search(query, request);

    Assert.assertFalse(result.hasContent());
    verify(appService, times(0)).findAll(request);
    verify(appService, times(1)).searchByAppIdOrAppName(query, request);
  }