solr或lucene中出现there are more terms than documents in field "name", but it's impossible to sort on tokenized fields异常

在使用solr的排序时出现了类似下面的异常:
there are more terms than documents in field "name", but it's impossible to sort on tokenized fields
name在solr中为text型字段
根据
http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/search/Sort.html

 

Encapsulates sort criteria for returned hits.

 

The fields used to determine sort order must be carefully chosen. Documents must contain a single term in such a field, and the value of the term should

indicate the document's relative position in a given sort order. The field must be indexed, but should not be tokenized, and does not need to be stored

(unless you happen to want it back with the rest of your document data). In other words:

 

document.add (new Field ("byNumber", Integer.toString(x), Field.Store.NO, Field.Index.NOT_ANALYZED));


的描述,sort的字段是"should not be tokenized",而solr中的配置是对text字段进行了tokeniz了的因此会出现类似下面的异常:
there are more terms than documents in field "name", but it's impossible to sort on tokenized fields

 

这里是nabble上一个用户关于这方面的问题
http://old.nabble.com/Exception-when-field-sort.-td21302894.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值