[hibernate-issues] [JIRA] (HSEARCH-3862) It is not possible to define "@FullTextFilterDef" filters.
Waldemar Kłaczyński (JIRA)
jira at hibernate.atlassian.net
Tue Mar 10 19:36:04 EDT 2020
Waldemar Kłaczyński ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A77e50cac-bda3-4af4-9bb3-6461f4d10eea ) *commented* on HSEARCH-3862 ( https://hibernate.atlassian.net/browse/HSEARCH-3862?atlOrigin=eyJpIjoiMDFkMjBkNmY4MDI0NDQxYjkxNTAxNzc5N2YzNGQyODQiLCJwIjoiaiJ9 )
Re: It is not possible to define "@FullTextFilterDef" filters. ( https://hibernate.atlassian.net/browse/HSEARCH-3862?atlOrigin=eyJpIjoiMDFkMjBkNmY4MDI0NDQxYjkxNTAxNzc5N2YzNGQyODQiLCJwIjoiaiJ9 )
I think that it would be easy to open such functionality is building a filter factory as a fragment of a predicate.
public static class TestFilterFactory implements FilterFactory {
@Override
public SearchPredicate create(FilterFactoryContext ctx) {
SearchPredicate filter = ctx.predicate()
.match().field( "fieldName" )
.matching( ctx.param( "match" ) )
.toPredicate();
return filter;
}
}
Such a filter could be, like in the previous version, declared using annotations.
@FullTextFilter(name= "test_filter" , factory = @FilterFactoryRef(type = TestFilterFactory.class))
public class Assortment implements Serializable {
....
Later, you could use such a filter when creating a query.
scope.query()
.where( f -> {
return f.bool()
.filter( f.def( "match_fieldName" ).param( "match" , true ) );
}).toQuery()
I think that this functionality would be very simple to implement in the current code.
( https://hibernate.atlassian.net/browse/HSEARCH-3862#add-comment?atlOrigin=eyJpIjoiMDFkMjBkNmY4MDI0NDQxYjkxNTAxNzc5N2YzNGQyODQiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HSEARCH-3862#add-comment?atlOrigin=eyJpIjoiMDFkMjBkNmY4MDI0NDQxYjkxNTAxNzc5N2YzNGQyODQiLCJwIjoiaiJ9 )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:545f4ab )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200310/62bd2fe9/attachment.html
More information about the hibernate-issues
mailing list