DiscoverQueryBuilder implements InitializingBean { public DiscoverQuery buildFacetQuery(Context context, IndexableObject scope, DiscoveryConfiguration discoveryConfiguration, String prefix, String query, List<SearchFilter> searchFilters, String dsoType, Pageable page, String facetName) throws DSpaceBadRequestException { List<String> dsoTypes = dsoType != null ? singletonList(dsoType) : emptyList(); return buildFacetQuery( context, scope, discoveryConfiguration, prefix, query, searchFilters, dsoTypes, page, facetName); }  @Override void afterPropertiesSet(); DiscoverQuery buildQuery(Context context, IndexableObject scope,
                                    DiscoveryConfiguration discoveryConfiguration,
                                    String query, List<SearchFilter> searchFilters,
                                    String dsoType, Pageable page); DiscoverQuery buildQuery(Context context, IndexableObject scope,
                                    DiscoveryConfiguration discoveryConfiguration,
                                    String query, List<SearchFilter> searchFilters,
                                    List<String> dsoTypes, Pageable page); DiscoverQuery buildFacetQuery(Context context, IndexableObject scope,
                                         DiscoveryConfiguration discoveryConfiguration,
                                         String prefix, String query, List<SearchFilter> searchFilters,
                                         String dsoType, Pageable page, String facetName); DiscoverQuery buildFacetQuery(Context context, IndexableObject scope,
                                         DiscoveryConfiguration discoveryConfiguration,
                                         String prefix, String query, List<SearchFilter> searchFilters,
                                         List<String> dsoTypes, Pageable page, String facetName); void setIndexableFactories(List<IndexFactory> indexableFactories);  }
@Test public void testBuildFacetQuery() throws Exception { DiscoverQuery discoverQuery = queryBuilder.buildFacetQuery(context, scope, discoveryConfiguration, "prefix", query, Arrays.asList(searchFilter), "item", page, "subject"); assertThat(discoverQuery.getFilterQueries(), containsInAnyOrder("archived:true", "subject:\"Java\"")); assertThat(discoverQuery.getQuery(), is(query)); assertThat(discoverQuery.getDSpaceObjectFilters(), contains(IndexableItem.TYPE)); assertThat(discoverQuery.getSortField(), is(emptyOrNullString())); assertThat(discoverQuery.getMaxResults(), is(0)); assertThat(discoverQuery.getStart(), is(0)); assertThat(discoverQuery.getFacetMinCount(), is(1)); assertThat(discoverQuery.getFacetOffset(), is(10)); assertThat(discoverQuery.getFacetFields(), hasSize(1)); assertThat(discoverQuery.getFacetFields(), contains( discoverFacetFieldMatcher(new DiscoverFacetField("subject", TYPE_TEXT, 11, COUNT, "prefix")) )); }
@Test(expected = DSpaceBadRequestException.class) public void testInvalidSearchFacet() throws Exception { queryBuilder.buildFacetQuery(context, scope, discoveryConfiguration, null, query, Arrays.asList(searchFilter), "item", page, "test"); }