title: How to order by localized String with hibernate search (@ElementCollection Map)
body: <p>I have the following entities:</p>
  <pre><code>@Entity
  @Table(name = &quot;item&quot;)
  public class Item {
  
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(length = 16, updatable = false)
    private UUID id;
  
  
    @Column(nullable = false)
    @KeywordField
    private String classifier;
  
  
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = ATTRIBUTE_LOCALIZEDNAME)
    @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
    @IndexedEmbedded(name = ATTRIBUTE_LOCALIZEDNAME)
    private LocalizedString localizedname = new LocalizedString();
  
  }
  </code></pre>
  <p>and:</p>
  <pre><code>@Entity
  @Table(name = &quot;localizedstring&quot;)
  public class LocalizedString {
  
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(length = 16, updatable = false)
    private UUID id;
  
    @ElementCollection(fetch = FetchType.EAGER)
    @MapKeyColumn(name = &quot;locale&quot;)
    @CollectionTable(name = &quot;localizedstring_stringvalue&quot;, joinColumns = @JoinColumn(name = &quot;localizedstring&quot;))
    @KeywordField(
      sortable = Sortable.YES,
      normalizer = BaseAnalysisConfigurer.NORMALIZER_SORT
    )
    private final Map&lt;String, String&gt; stringvalue = new HashMap&lt;&gt;();
  
  
  }
  </code></pre>
  <p>These 2 entities reusult in 3 tables with the following data as example:</p>
  <p>item table:</p>
  <pre><code>id;classifier;name;localizedname
  item-id-1;SALUT;Herr;localized-sting-id-1
  item-id-2;SALUT;Frau;localized-sting-id-2
  </code></pre>
  <p>localizedstring table:</p>
  <pre><code>id
  localized-sting-id-1
  localized-sting-id-2
  </code></pre>
  <p>localizedstring-stringvalue table:</p>
  <pre><code>localizedstring;locale;stringvalue
  localized-sting-id-1;de;Herr
  localized-sting-id-2;de;Frau
  localized-sting-id-1;en;Mr
  localized-sting-id-2;en;Mrs
  </code></pre>
  <p>now I can search and sort the item data by classifier like so:</p>
  <pre><code>Search.session(entityManager)
    .search(Organization.class)
      .where(
        queryBuilder.bool()
          .must(queryBuilder.match()
            .field(&quot;classifier&quot;).matching(&quot;something&quot;)
      )
      .sort(
        queryBuilder
          .field(&quot;classifier&quot;)
            .order(SortOrder.ASC)
      )
  </code></pre>
  <p>But I would like to sort the items by the value of the localized string, either in german or in english depending on the logged in user...
  something like:</p>
  <pre><code>    Search.session(entityManager)
        .search(Organization.class)
          .where(
            queryBuilder.bool()
              .must(queryBuilder.match()
                .field(&quot;classifier&quot;).matching(&quot;SALUT&quot;)
          )
          .sort(
            queryBuilder
              .field(&quot;localizedname.stringvalue&quot;)
                .where(&quot;localizedname.locale&quot; == &quot;de&quot;)
                  .order(SortOrder.ASC)
          )
  </code></pre>
  <p>is something like this possible somehow ??</p>