具有排序规则的休眠搜索排序

问题描述 投票:0回答:1

我将Hibernate搜索版本从4.3.0.Final升级到了最新的稳定版本-5.4.12.Final。除排序挪威语单词外,其他所有内容都很好。在旧版本的hibernate中,构造函数中存在带有语言环境的SortField:

/** Creates a sort, possibly in reverse, by terms in the given field sorted
   * according to the given locale.
   * @param field  Name of field to sort by, cannot be <code>null</code>.
   * @param locale Locale of values in the field.
   */
  public SortField (String field, Locale locale, boolean reverse) {
    initFieldType(field, STRING);
    this.locale = locale;
    this.reverse = reverse;
  }

但是在新的休眠搜索中,SortField没有语言环境。根据休眠参考文档(https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#_analysis)中的外文排序单词,我们应将Collat​​ionKeyFilterFactory与规范化器一起使用。但是在此版本的休眠搜索中没有此类。 Maven pom:

<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-search-orm</artifactId>
   <version>5.11.5.Final</version>
</dependency>

问题:在休眠搜索中排序挪威语单词时我应该使用/创建什么?

现在我有这样的排序顺序:

atest,btest,ctest,ztest,åtest,ætest,øtest

正确的顺序:

atest,btest,ctest,ztest,ætest,øtest,åtest

非常相似的问题,没有答案:How to do case insensitive sorting of Norwegian characters (Æ, Ø, and Å) using Hibernate Lucene Search?

java lucene hibernate-search
1个回答
1
投票
在班级的Javadoc中,它说:

已弃用。请改用CollationKeyAnalyzer

您可以找到Javadoc here
© www.soinside.com 2019 - 2024. All rights reserved.