See {{org.hibernate.search.query.dsl.impl.DiscreteFacetRequest.SimpleFacet.getFacetQuery()}}:
{code} @Override public Query getFacetQuery() { return new TermQuery( new Term( getFieldName(), getValue() ) ); } {code}
Keep in mind that getFieldName() is supposed to return the *facet* name, and that the facet field is not indexed, only doc values are stored... Which means such a query will never work if:
* The facet field has a different name than the source field ({{@Facet.name}} has been set to something other than the source field name) * or the source field is numeric (you would need a numeric range query instead of a term query in that case, see {{org.hibernate.search.bridge.util.impl.NumericFieldUtils.createExactMatchQuery(String, Object)}})
I think there is a few confusions in the code between the facet name ({{@Facet.name}}) and the source field name ({{@Field.name}}, {{@Facet.forField}}), and these confusions should be addressed.
I managed to reproduce the issues on one of my branches; see https://github.com/yrodiere/hibernate-search/tree/HSEARCH-2668 |
|