<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 
        <base href="https://hibernate.atlassian.net"> 
        <title>Message Title</title> 
    </head> 
    <body class="jira" style="color: #333333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429"> 
        <table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0" bgcolor="#f5f5f5"> 
            <!-- header here --> 
            <tbody>
                <tr> 
                    <td id="header-pattern-container" style="padding: 0; border-collapse: collapse; padding: 10px 20px"> 
                        <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="header-avatar-image-container" valign="top" style="padding: 0; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px" width="32"> <img id="header-avatar-image" class="image_fix" src="https://secure.gravatar.com/avatar/d7280b40955b8d69113f7ddbf11c3148?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FWK-0.png&amp;size=48&amp;s=48" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"> </td> 
                                    <td id="header-text-container" valign="middle" style="padding: 0; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="wklaczynski" style="color:#6c797f;; color: #3b73af; text-decoration: none" id="email_wklaczynski" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A77e50cac-bda3-4af4-9bb3-6461f4d10eea"> Waldemar Kłaczyński </a> <strong>commented</strong> on <a href="https://hibernate.atlassian.net/browse/HSEARCH-3325?atlOrigin=eyJpIjoiNWIzMDM1MWIxMzExNGU1OTg0NTUxMGY5ZTVjZTk0ZjkiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-dd6680f4-3b65-4472-8faf-3a00d72219fe" height="16" width="16" border="0" align="absmiddle" alt="Task"> HSEARCH-3325</a> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="email-content-container" style="padding: 0; border-collapse: collapse; padding: 0 20px"> 
                        <table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; border-spacing: 0; border-collapse: separate"> 
                            <tbody>
                                <tr> 
                                    <!-- there needs to be content in the cell for it to render in some clients --> 
                                    <td class="email-content-rounded-top mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 15px; background-color: #ffffff; border-left: 1px solid #cccccc; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly" height="10" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td style="vertical-align: top;; padding: 0; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HSEARCH-3325?atlOrigin=eyJpIjoiNWIzMDM1MWIxMzExNGU1OTg0NTUxMGY5ZTVjZTk0ZjkiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none">Re: Search 6 groundwork - Restore support for full-text filters</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td id="text-paragraph-pattern-top" class="email-content-main mobile-expand  comment-top-pattern" style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; border-bottom: none; padding-bottom: 0" bgcolor="#ffffff"> 
                                        <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0; border-collapse: collapse; padding: 0 0 10px"> <p style="margin: 10px 0 0; margin-top: 0">It's about simplifying your queries. This allows you to restore the previous strategy of defining filters. Of course, it does not impose anything, it is an additional solution that already existed in the previous version and was very useful. The solution restores the previous functionality. It only consists in the fact that in queries you can, as before, draw on predefined filters. Of course, you can do without it. But it is about building as many tools as possible to simplify work with Apache Lucene. Currently, with my patch, I can write a query in a simpler way:</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">    <span class="code-keyword" style="color: #000091">private</span> <span class="code-keyword" style="color: #000091">class </span>BeansDataModel <span class="code-keyword" style="color: #000091">extends</span> SearchDataModel&lt;Assortment&gt; {

        @Override
        <span class="code-keyword" style="color: #000091">public</span> SearchQuery&lt;Assortment&gt; search(List&lt;SortMeta&gt; multiSortMeta, Map&lt;<span class="code-object" style="color: #910091">String</span>, <span class="code-object" style="color: #910091">Object</span>&gt; filters) {

            <span class="code-keyword" style="color: #000091">try</span> {
                SearchSession session = Search.session(em);
                SearchScope&lt;Assortment&gt; scope = session.scope(Assortment.class);

                SearchSortFactory sorter = scope.sort();
                CompositeSortComponentsStep sort = sorter.composite();

                SearchPredicateFactory spf = scope.predicate();

                BooleanPredicateClausesStep pricesFilter = spf.bool()
                        .filter(spf.def(<span class="code-quote" style="color: #009100">"prices.is-active"</span>))
                        .filter(spf.def(<span class="code-quote" style="color: #009100">"prices.is-shared"</span>)
                                .param(<span class="code-quote" style="color: #009100">"user"</span>, identity.getAccount())
                        );

                sort.add(sorter.field(<span class="code-quote" style="color: #009100">"prices.bruttoPrice_sort"</span>)
                        .asc()
                        .mode(MultiValue.MIN)
                        .filter(pricesFilter));

                <span class="code-keyword" style="color: #000091">for</span> (SortMeta sortMeta : multiSortMeta) {
                    <span class="code-object" style="color: #910091">String</span> fieldName = sortMeta.getSortField();
                    <span class="code-keyword" style="color: #000091">switch</span> (sortMeta.getSortOrder()) {
                        <span class="code-keyword" style="color: #000091">case</span> ASCENDING:
                            sort.add(sorter.field(fieldName).asc());
                            <span class="code-keyword" style="color: #000091">break</span>;
                        <span class="code-keyword" style="color: #000091">case</span> DESCENDING:
                            sort.add(sorter.field(fieldName).desc());
                            <span class="code-keyword" style="color: #000091">break</span>;
                    }
                }

                PredicateFinalStep select;
                <span class="code-keyword" style="color: #000091">if</span> (searchFullText != <span class="code-keyword" style="color: #000091">null</span>) {
                    select = scope.predicate().simpleQueryString()
                            .field(<span class="code-quote" style="color: #009100">"shoppingName"</span>).boost(0.5f)
                            .matching(searchFullText);
                } <span class="code-keyword" style="color: #000091">else</span> {
                    select = scope.predicate()
                            .matchAll();
                }

                SearchQuery&lt;Assortment&gt; query = session.search(scope)
                        .where((f) -&gt; f.bool().must(select)
                        .filter(f.nested()
                                .objectField(<span class="code-quote" style="color: #009100">"prices"</span>)
                                .nest(pricesFilter)
                        )).sort(sort.toSort()).toQuery();

                <span class="code-keyword" style="color: #000091">return</span> query;
            } <span class="code-keyword" style="color: #000091">catch</span> (Exception ex) {
                <span class="code-keyword" style="color: #000091">throw</span> <span class="code-keyword" style="color: #000091">new</span> IllegalStateException(ex);
            }
        }

    }

</pre> 
                                                            </div>
                                                        </div> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">@Entity(name = <span class="code-quote" style="color: #009100">"Assortment"</span>)
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>Assortment {
....
    @IndexedEmbedded(storage = ObjectFieldStorage.NESTED)
    @OneToMany(mappedBy = <span class="code-quote" style="color: #009100">"assortment"</span>, orphanRemoval = <span class="code-keyword" style="color: #000091">true</span>, fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    <span class="code-keyword" style="color: #000091">private</span> List&lt;AssortmentPrice&gt; prices = <span class="code-keyword" style="color: #000091">new</span> ArrayList&lt;&gt;();
...</pre> 
                                                            </div>
                                                        </div> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">@FullTextFilter(name = <span class="code-quote" style="color: #009100">"is-active"</span>, factory = @FilterFactoryRef(type = PricesActiveFilterFactory.class))
@FullTextFilter(name = <span class="code-quote" style="color: #009100">"is-shared"</span>, factory = @FilterFactoryRef(type = PermissionsFilterFactory.class), params = {
    @FilterParam(name = <span class="code-quote" style="color: #009100">"operation"</span>, value = <span class="code-quote" style="color: #009100">"share"</span>),
    @FilterParam(name = <span class="code-quote" style="color: #009100">"field"</span>, value = <span class="code-quote" style="color: #009100">"sharings"</span>)
})
@Entity(name = <span class="code-quote" style="color: #009100">"AssortmentPrice"</span>)
<span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>AssortmentPrice <span class="code-keyword" style="color: #000091">implements</span> Serializable {
....
    @FullTextField(analyzer = <span class="code-quote" style="color: #009100">"permission"</span>)
    @Convert(converter = PermissionsConverter.class)
    @Column(name = <span class="code-quote" style="color: #009100">"Sharings"</span>, length = 2048)
    <span class="code-keyword" style="color: #000091">private</span> Permissions sharings = <span class="code-keyword" style="color: #000091">new</span> Permissions();

    @GenericField
    @Column(name = <span class="code-quote" style="color: #009100">"Active"</span>)
    <span class="code-keyword" style="color: #000091">private</span> <span class="code-object" style="color: #910091">boolean</span> active = <span class="code-keyword" style="color: #000091">true</span>;
}
</pre> 
                                                            </div>
                                                        </div> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal"><span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>PermissionsFilterFactory <span class="code-keyword" style="color: #000091">implements</span> FilterFactory {

    @Override
    <span class="code-keyword" style="color: #000091">public</span> SearchPredicate create(FilterFactoryContext ctx) {
        SearchPredicate filter;
        SearchPredicateFactory predicate = ctx.predicate();

        Account user = ctx.param(<span class="code-quote" style="color: #009100">"user"</span>);
        <span class="code-object" style="color: #910091">String</span> fieldPath = ctx.resolvePath(ctx.param(<span class="code-quote" style="color: #009100">"field"</span>));
        <span class="code-object" style="color: #910091">String</span> operation = ctx.param(<span class="code-quote" style="color: #009100">"operation"</span>);

        <span class="code-keyword" style="color: #000091">if</span> (operation == <span class="code-keyword" style="color: #000091">null</span>) {
            operation = <span class="code-quote" style="color: #009100">"read"</span>;
        }

        PermissionQuery query = <span class="code-keyword" style="color: #000091">new</span> PermissionQuery(fieldPath, operation, user);
        filter = predicate.extension(LuceneExtension.get())
                .fromLuceneQuery(query)
                .toPredicate();

        <span class="code-keyword" style="color: #000091">return</span> filter;
    }

}</pre> 
                                                            </div>
                                                        </div> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px; border-radius: 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-java" style="margin: 10px 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal"><span class="code-keyword" style="color: #000091">public</span> <span class="code-keyword" style="color: #000091">class </span>PricesActiveFilterFactory <span class="code-keyword" style="color: #000091">implements</span> FilterFactory {

    @Override
    <span class="code-keyword" style="color: #000091">public</span> SearchPredicate create(FilterFactoryContext ctx) {
        SearchPredicate filter;
        <span class="code-object" style="color: #910091">String</span> fieldPath = ctx.resolvePath(<span class="code-quote" style="color: #009100">"active"</span>);

        filter = ctx.predicate()
                .match().field(fieldPath)
                .matching(<span class="code-keyword" style="color: #000091">true</span>)
                .toPredicate();

        <span class="code-keyword" style="color: #000091">return</span> filter;
    }

}</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0">Of course I know you can do it differently. Similarly to version 5 it was possible but defining filters in the object type was useful for some. For me it was a valuable property that was in the previous version. I think that this possibility will not hurt in version 6.x, and for some it can be very useful. I have a working solution ready.</p> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> <script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "description": "View Issue",
  "potentialAction": {
    "@type": "ViewAction",
        "target": "https://hibernate.atlassian.net/browse/HSEARCH-3325?inbox=true&focusedCommentId=106331&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-106331",
    "name": "View Comment"
      },
  "publisher": {
    "@type": "Organization",
    "name": "Atlassian",
    "url": "https://www.atlassian.com"
  }
}
</script> 
                                        <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="actions-pattern-container" valign="middle" style="padding: 0; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                                        <table align="left" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                                            <tbody>
                                                                <tr> 
                                                                    <td class="actions-pattern-action-icon-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0; vertical-align: middle"> <a href="https://hibernate.atlassian.net/browse/HSEARCH-3325#add-comment?atlOrigin=eyJpIjoiNWIzMDM1MWIxMzExNGU1OTg0NTUxMGY5ZTVjZTk0ZjkiLCJwIjoiaiJ9" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-3c1292f2-d143-4a6a-b68c-81493dca0a71" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle"> </a> </td> 
                                                                    <td class="actions-pattern-action-text-container" style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://hibernate.atlassian.net/browse/HSEARCH-3325#add-comment?atlOrigin=eyJpIjoiNWIzMDM1MWIxMzExNGU1OTg0NTUxMGY5ZTVjZTk0ZjkiLCJwIjoiaiJ9" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> </td> 
                                                                </tr> 
                                                            </tbody>
                                                        </table> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <!-- there needs to be content in the cell for it to render in some clients --> 
                                <tr> 
                                    <td class="email-content-rounded-bottom mobile-expand" style="padding: 0; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #ffffff; border-top: 0; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly" height="5" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="footer-pattern" style="padding: 0; border-collapse: collapse; padding: 12px 20px"> 
                        <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                            <tbody>
                                <tr> 
                                    <td id="footer-pattern-mobile-separated-links" class="mobile-resize-text" width="100%" colspan="2" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> Get Jira notifications on your phone! Download the Jira Cloud app for <a href="https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail" style="color: #3b73af; text-decoration: none">Android</a> or <a href="https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8" style="color: #3b73af; text-decoration: none">iOS</a> 
                                        <hr> </td> 
                                </tr> 
                                <tr> 
                                    <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> This message was sent by Atlassian Jira <span id="footer-build-information">(v1001.0.0-SNAPSHOT#100122-<span title="53b61715aeee76b2b8e8a569ad6ca3ddb7ce64ca" data-commit-id="53b61715aeee76b2b8e8a569ad6ca3ddb7ce64ca}">sha1:53b6171</span>)</span> </td> 
                                    <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                        <table style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="footer-pattern-logo-desktop-padding" style="padding: 0; border-collapse: collapse; padding-top: 3px; opacity: 0.150"> <img id="footer-pattern-logo-desktop" src="cid:jira-generated-image-static-footer-desktop-logo-13bd42af-9ba7-42a6-a27c-62e619f7378c" alt="Atlassian logo" title="Atlassian logo" width="192" height="24" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    </body>
</html>