}
@TestInfo(testType=SYSTEM)
public void testFacetFiltering() throws InterruptedException, ParseException {
indexBackwardsFacetedToDocuments(this.indexEngine.getIndexer());
DocumentSearcher searcher = this.indexEngine.getSearcher();
Multimap<String, String> categoriesFilter = HashMultimap.create();
categoriesFilter.put("PRECIO", "BAJO");
SearchResults searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
int matches = searchResults.getMatches();
Map<String, Multiset<String>> facets = searchResults.getFacets();
//System.out.println(matches);
//System.out.println(searchResults.getResults());
//System.out.println(searchResults.getFacets());
assertEquals(4, matches);
checkSearchResults(searchResults.getResults(), new String[] {"D6", "D5", "D2", "D1"});
categoriesFilter = HashMultimap.create();
categoriesFilter.put("TIPO", "NAH");
categoriesFilter.put("TIPO", "TERCERO");
searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
matches = searchResults.getMatches();
//System.out.println(matches);
//System.out.println(searchResults.getResults());
//System.out.println(searchResults.getFacets());
assertEquals(5, matches);
checkSearchResults(searchResults.getResults(), new String[] {"D8", "D7", "D5", "D3", "D1"});
categoriesFilter = HashMultimap.create();
categoriesFilter.put("TIPO", "NAH");
categoriesFilter.put("TIPO", "TERCERO");
categoriesFilter.put("PRECIO", "BAJO");
searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
matches = searchResults.getMatches();
//System.out.println(matches);
//System.out.println(searchResults.getResults());
//System.out.println(searchResults.getFacets());