Created
March 10, 2011 17:18
-
-
Save hferentschik/864487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testFacetDrillDown() throws Exception { | |
Query luceneQuery = builder.keyword().onField( "make" ).matching( "Honda" ).createQuery(); | |
FacetRequest request = builder.facet() | |
.name( facetName ) | |
.onField( indexFieldName ) | |
.createFacet(); | |
FullTextQuery query = fullTextSession.createFullTextQuery( luceneQuery, Car.class ); | |
query.enableFacet( request ); | |
assertEquals( "Wrong number of query matches", 13, query.list().size() ); | |
List<Facet> facetList = assertAndReturnFacetList( query ); | |
assertFacetCounts( facetList, new int[] { 5, 4, 4, 0 } ); | |
Filter facetFilter = facetList.get( 0 ).getFacetFilter(); | |
query.setFilter( facetFilter ); | |
assertEquals( "Wrong number of query matches", 5, query.list().size() ); | |
List<Facet> newFacetList = assertAndReturnFacetList( query ); | |
assertFacetCounts( newFacetList, new int[] { 5, 0, 0, 0 } ); | |
facetFilter = facetList.get( 1 ).getFacetFilter(); | |
query.setFilter( facetFilter ); | |
assertEquals( "Wrong number of query matches", 4, query.list().size() ); | |
newFacetList = assertAndReturnFacetList( query ); | |
assertFacetCounts( newFacetList, new int[] { 4, 0, 0, 0 } ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment