Currently those filters are ignored not executed as one would expect (see HSEARCH-2842).
Executing In particular, paging and result size completely ignore the Hibernate ORM filters in .
Taking Hibernate ORM after we executed the full-text query into account in paging and result size would probably result in terrible performance, but we could consider alternative solutions.
For instance, what if we provided a way for users to map Hibernate ORM filters to full-text filters? Something like that:
{code} @Entity(name = "Account") @FilterDef(name="activeAccount", parameters=@ParamDef( name="active", type="boolean" ) ) @Filter(name="activeAccount", condition="active = :active") @FullTextFilterDef(name = "activeAccount", impl = ActiveAccountFilter.class) @org.hibernate.search.orm.FullTextFilterMapping(ormRef = "activeAccount", searchRef = "activeAccount") public static class Account { {code}
We could also assume that full-text filters with the same name as a Hibernate ORM filter are full-text equivalent of the ORM filter, but that seems a bit dangerous to me.
Also, we could consider an option to make it mandatory for Hibernate ORM filters to be mapped to an Hibernate Search filter when they are used in a {{org.hibernate.search.jpa.FullTextQuery}} or {{org.hibernate.search.FullTextQuery}}. We'd throw an exception upon unknown filters, making the filtering a bit more secure. Unless we can break APIs, this option should be disabled by default, though.
In any case, I'm not sure we can implement it before 6. |
|