Facet and filteredQuery

Hello,

I'm trying to integrate facets on filtered query. Seems like the facet
ignores the query. Here is my code:

TermFilterBuilder tfb = FilterBuilders.termFilter( "cId", 1234);

XContentQueryBuilder matchAllFiltered =
QueryBuilders.filteredQuery( QueryBuilders.matchAllQuery(), tfb );

SearchResponse response =
searchRequestBuilder.setSearchType( SearchType.DEFAULT ).setQuery( matchAllFiltered ).addFacet( FacetBuilders.termsFacet( "facet1" ).field( "counter" ).size( 1000000 ).global( false ).order( ComparatorType.COUNT ) ).execute().actionGet();

The results are identical to the case where setQuery() is set with
matchAllQuery(). After I added facetFilter( tfb ) to the facet the
results were as expected (at least as I expected :-)). Can you explain
please why the facet ignored the query although global set to false?

Thanks!

That should not be the case. Gist a test case and I can have a look.
On Monday, February 7, 2011 at 8:19 AM, barak wrote:

Hello,

I'm trying to integrate facets on filtered query. Seems like the facet
ignores the query. Here is my code:

TermFilterBuilder tfb = FilterBuilders.termFilter( "cId", 1234);

XContentQueryBuilder matchAllFiltered =
QueryBuilders.filteredQuery( QueryBuilders.matchAllQuery(), tfb );

SearchResponse response =
searchRequestBuilder.setSearchType( SearchType.DEFAULT ).setQuery( matchAllFiltered ).addFacet( FacetBuilders.termsFacet( "facet1" ).field( "counter" ).size( 1000000 ).global( false ).order( ComparatorType.COUNT ) ).execute().actionGet();

The results are identical to the case where setQuery() is set with
matchAllQuery(). After I added facetFilter( tfb ) to the facet the
results were as expected (at least as I expected :-)). Can you explain
please why the facet ignored the query although global set to false?

Thanks!