Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-3465

Multi-fields (backend-defined copies of fields using a slightly different type)

    Details

      Description

      See the Elasticsearch documentation: multi-fields

      See also HSEARCH‌-2215

      The idea is to define additional fields that take the same input as other fields, but transform/store it differently.
      We could use a "source" or "derivedFrom" or "subFieldOf" attribute on @XXXField annotation:

      @FullTextField(name = “myField”, bridge = …)
      @KeywordField(subFieldOf = "myField", name = "sort", sortable = Sortable.YES, normalizer = "sortNormalizer")
      

      Note that we would have to forbid the definition of a bridge on such field, because the copy happens automatically in the backend.

      The backend APIs could expose something like this:

      schemaElement.field( "myField", f -> f.asLocalDate().toIndexFieldType() )
      		.subField( "sort", f -> f.asLocalDate().sortable( Sortable.YES ).normalizer( "sortNormalizer" ).toIndexFieldType() )
      									.createAccessor();
      

      Or maybe a better API could be designed while we address HSEARCH‌-3444 .

      Original discussion: https://docs.google.com/document/d/16PAa__LsxyLZcbW3q1MvgyIznh4ZnCYLupbNMXKMRds/edit#heading=h.gxh9craiaqrn

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                yrodiere Yoann Rodière
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: