<!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://avatar-cdn.atlassian.com/2a8bdd4ffd282b7185c74b52ab452617?s=48&amp;d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F2a8bdd4ffd282b7185c74b52ab452617%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue" 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="yrodiere" id="email_yrodiere" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=yrodiere" style="color:#6c797f;; color: #3b73af; text-decoration: none">Yoann Rodière</a> <strong>updated</strong> an issue </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 class="page-title-pattern-first-line " style="padding: 0; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; padding-top: 10px"> <a href="https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none">Hibernate Search</a> / <a href="https://hibernate.atlassian.net/browse/HSEARCH-3265?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-03fedc11-36e7-4820-ae40-7963134baa0f" height="16" width="16" border="0" align="absmiddle" alt="Task" style="vertical-align: text-bottom"></a> <a href="https://hibernate.atlassian.net/browse/HSEARCH-3265?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none">HSEARCH-3265</a> </td> 
                                                </tr> 
                                                <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-3265?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" style="color: #3b73af; text-decoration: none">Search 6 groundwork - Add support for enough types to release an Alpha</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand  wrapper-special-margin" 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; padding-top: 10px; padding-bottom: 5px" bgcolor="#ffffff"> 
                                        <table class="keyvalue-table" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0"> 
                                            <tbody>
                                                <tr> 
                                                    <th style="color: #707070; font: normal 14px/20px Arial, sans-serif; text-align: left; vertical-align: top; padding: 2px 0">Change By:</th> 
                                                    <td style="padding: 0; border-collapse: collapse; font: normal 14px/20px Arial, sans-serif; padding: 2px 0 2px 5px; vertical-align: top"> <a class="user-hover" rel="yrodiere" id="email_yrodiere" href="https://hibernate.atlassian.net/secure/ViewProfile.jspa?name=yrodiere" style="color:#6c797f;; color: #3b73af; text-decoration: none">Yoann Rodière</a> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand  issue-description-container" 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; padding-top: 5px; padding-bottom: 10px" 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"> <span class="diffaddedchars" style="background-color:#ddfade;">We need to add support for fields of type {{Long}}, {{java.util.Date}} and {{Boolean}}, both in the backends (Elasticsearch + Lucene) and the mapper (POJO mapper).<br><br>"</span> <span class="diffcontext">Support</span> <span class="diffaddedchars" style="background-color:#ddfade;">" here means:<br><br>* Allow to map properties of these types in the POJO mapper, thanks to default value bridges.<br>* Allow to map identifiers of these types (Date and Long, probably not Boolean) in the POJO mapper, thanks to default identifier bridges.<br>* Allow to declare index fields of these types in indexes<br>* Allow to create predicates on fields of these types ("match" and "range" predicates, mainly)<br>* Allow to create sorts on fields of these types<br>* Allow to project on fields of these types<br><br>You can use the existing code</span> <span class="diffcontext"> for</span> <span class="diffaddedchars" style="background-color:#ddfade;"> similar types to help you. For example there is already support for {{Integer}} (similar to Long) and there is already support for {{LocalDate}} (similar to {{Date}}).<br><br>On the mapper side, it should be rather easy. You need to:<br><br>* add test methods to {{org.hibernate.search.integrationtest.mapper.pojo.mapping.definition.DocumentIdDefaultBridgeIT}} for each newly supported type and its primitive counterpart (if any); use {{boxedInteger}} and {{primitiveInteger}} as examples. The tests should initially fail. Note that the test for {{LocalDate}} is missing, maybe take this opportunity to add it?<br>* add test methods to {{org.hibernate.search.integrationtest.mapper.pojo.mapping.definition.FieldDefaultBridgeIT}} for each newly supported type and its primitive counterpart (if any); use {{boxedInteger}} and {{primitiveInteger}} as examples. The tests should initially fail.<br>*&nbsp;&nbsp;add implementation of {{IdentifierBridge}} next to {{org.hibernate.search.mapper.pojo.bridge.builtin.impl.DefaultIntegerIdentifierBridge}}. Note that the implementation for {{LocalDate}} is missing, maybe take this opportunity to add it?<br>* register the new identifier bridge implementations in the {{org.hibernate.search.mapper.pojo.bridge.impl.BridgeResolver}} constructor<br>* register pass-through value bridges for each type in the {{org.hibernate.search.mapper.pojo.bridge.impl.BridgeResolver}} constructor<br><br>And voilà! The tests should now pass.<br><br>The backend side will be a bit more complex. I recommend first doING everything for {{Long}} (tests, indexing, predicates, sorts, projections), and only when it works correctly, have a look at the other types.<br><br>First, the tests . See these classes:<br><br>* {{org.hibernate.search.integrationtest.backend.tck.search.predicate.MatchSearchPredicateIT}} for the "match" predicate; you should only need to add an entry to the list returned by {{org.hibernate.search.integrationtest.backend.tck.search.predicate.MatchSearchPredicateIT.IndexMapping#mapSupportedFields}}<br>* {{org.hibernate.search.integrationtest.backend.tck.search.predicate.RangeSearchPredicateIT}} for the "range" predicate; you should only need to add an entry to the list returned by {{org.hibernate.search.integrationtest.backend.tck.search.predicate.RangeSearchPredicateIT.IndexMapping#mapSupportedFields}} or directly to {{org.hibernate.search.integrationtest.backend.tck.search.predicate.RangeSearchPredicateIT.IndexMapping#unsupportedFieldModels}}<br>* {{org.hibernate.search.integrationtest.backend.tck.search.sort.SearchSortByFieldIT}} for sorts, add an entry to {{org.hibernate.search.integrationtest.backend.tck.search.sort.SearchSortByFieldIT#mapSupportedFields}} or {{org.hibernate.search.integrationtest.backend.tck.search.sort.SearchSortByFieldIT#mapUnsupportedFields}}<br>* {{org.hibernate.search.integrationtest.backend.tck.search.projection.SearchProjectionIT}} for projections, add an entry to {{org.hibernate.search.integrationtest.backend.tck.search.projection.SearchProjectionIT#mapSupportedFields}}<br><br>After that, all these tests should fail. Which is good!<br><br>Note that in order to run the tests from the IDE, you will have to execute {{org.hibernate.search.integrationtest.backend.lucene.util.LuceneTckTestRunner}} or {{org.hibernate.search.integrationtest.backend.elasticsearch.util.ElasticsearchTckTestRunner}} (adjust the classname filter as necessary, but please don't commit the filter change). For Elasticsearch, you'll need a running ES instance; see https://github.com/Sanne/elasticsearch-light-testing.<br><br>Then, the Elasticsearch implementation. You will need to:<br><br>* Create a new "codec", which is the class that converts the "Hibernate Search" type ({{Long}} in this case) to the backend-specific type (a {{JsonElement}} for Elasticsearch). Have a look at org.hibernate.search.backend.elasticsearch.types.codec.impl.IntegerFieldCodec, copy-paste it as "LongFieldCodec" and adapt it as necessary.<br>* Create a new "Index schema field context", which implements the DSL presented to the user and to the mapper when adding a field to the index. Have a look at {{org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchIntegerIndexSchemaFieldContextImpl}}, copy/paste it as "ElasticsearchLongIndexSchemaFieldContextImpl" and adapt it as necessary.<br>* Instantiate this new context from an {{asLong}} method in {{org.hibernate.search.backend.elasticsearch.document.model.dsl.impl.ElasticsearchIndexSchemaFieldContextImpl}} (the method should be defined in the implemented interface, {{org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaFieldContext}}). Do not forget to update the {{org.hibernate.search.backend.elasticsearch.document.model.dsl.impl.ElasticsearchIndexSchemaFieldContextImpl#as}} method to delegate to {{asLong}} when the given type is {{Long.class}}.<br><br>This should do the trick for Elasticsearch.<br><br>Lucene should be fairly similar, except that you will additionally have to create</span> <span class="diffcontext"> one</span> <span class="diffaddedchars" style="background-color:#ddfade;"> class per field</span> <span class="diffcontext"> type</span> <span class="diffaddedchars" style="background-color:#ddfade;"> for each</span> <span class="diffcontext"> of</span> <span class="diffaddedchars" style="background-color:#ddfade;"> the following:<br><br>* the "match predicate builder", "range predicate builder, and "field predicate builder factory" which creates these builders. For example the factory for type integer will not be the same as for longs, because in Lucene, querying a Long field is done differently than querying an Integer field. See {{org.hibernate.search.backend.lucene.types.predicate.impl.IntegerFieldPredicateBuilderFactory}} for an example.<br>* the "field sort builder" and "field sort builder factory" which creates this builder. See {{org.hibernate.search.backend.lucene.types.sort.impl.IntegerFieldSortBuilderFactory}} for an example.<br><br>Then you will have to reference these types from the "Index schema field context", in the "contribute" method.<br><br>About java.util.Date:<br><br>* In the Elasticsearch backend, you will have to format the date to String before sending it to the cluster. See how it's done for {{LocalDate}} to get an idea of what I mean: {{org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchLocalDateIndexSchemaFieldContextImpl}}<br>* In the Lucene backend, you will have to convert the Date to an epoch in a specific converter. See how it's done for {{LocalDate}}: {{org.hibernate.search.backend.lucene.types.converter.impl.LocalDateFieldConverter}}<br><br>About boolean:<br><br>* Booleans can hardly be ordered, so you will have to disable range predicates and sorts on boolean fields. This essentially means you will need a specific "field predicate builder factory" and "field projection builder&nbsp;&nbsp;factory"; see how it's done for {{GeoPoint}}.<br><br><br>---<br><br>Initial ticket description:<br><br>The goal is to cover one type of</span> <span class="diffcontext"> each category:<br>* Numeric scalars (Integer + Long)<br>* Java 8 Date/time (LocalDate)<br>* java.util.Date<br>* String<br>* GeoPoint<br>* Enums<br>* Boolean<br><br>This means in particular supporting:<br><br>* Predicates (match, range, ...)<br>* Sorts<br>* Projections<br>* Default value bridges</span> </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-3265?inbox=true&",
    "name": "View Issue"
      },
  "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-3265#add-comment?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" 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-d8bb7a2e-c527-436e-91b4-552b4da04a67" 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-3265#add-comment?atlOrigin=eyJpIjoiMjdlZGY2N2MxMDA1NDkyNGE1MWUzYTJlMmI5NDg4OTEiLCJwIjoiaiJ9" 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#100095-<span title="e49d1740101d9a407860a8f0910d07b5f5de33c0" data-commit-id="e49d1740101d9a407860a8f0910d07b5f5de33c0}">sha1:e49d174</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-6e8b205d-f6d2-4813-a327-b595cbaa456b" 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>   
    
<img border="0" width="1" height="1" alt="" src="http://atlassian.et.e.sparkpost.com/q/gLqHfnp5bEP3cpjY4uFuvg~~/AAAAAQA~/RgRdwup2PlcLYXRsYXNzaWFudXNCCgAA9rbhW_3OeC1SIGhpYmVybmF0ZS1pc3N1ZXNAbGlzdHMuamJvc3Mub3JnWAQAAAAE">
</body>
</html>