lucene升级至5.1版本出现 :IllegalStateException: IllegalStateException: unexpected docvalues type NONE"
来源:互联网 发布:语音聊天变声软件 编辑:程序博客网 时间:2024/06/11 06:55
这前使用的lucene4.7版本,程序正常,现在升级到5.1时,索引文件正常,但在搜索的时候,出现:IllegalStateException: unexpected docvalues type NONE" on fields Use UninvertingReader or index with docvalues.
后才知道,是因为Sort排序对索引字段有了新的要求,即使用DocValuesField的字段才能进行排序。
查询doc文档,最终解决方法如下:
原来的代码:dfDocument.add(new LongField("id", Long.parseLong(id),Field.Store.YES));
现在的代码:dfDocument.add(new NumericDocValuesField("id",Long.parseLong(id)));
替换后一切OK,如果你想在查询中获取ID的字段值,那就多加一条排序的字段,那保留原代码,然后加一条:
dfDocument.add(new NumericDocValuesField("sortid",Long.parseLong(id)));
查询的时候,使用new Sort(new SortField("sortid", SortField.Type.LONG, true));作为排序。
1 0
- lucene升级至5.1版本出现 :IllegalStateException: IllegalStateException: unexpected docvalues type NONE"
- lucene搜索时出现异常unexpected docvalues type NONE for field 'modified' (expected=NUMERIC)
- IllegalStateException
- IllegalStateException
- IllegalStateException
- response.sendError出现IllegalStateException
- java.lang.IllegalStateException: No data type for
- Lucene系列-DocValues
- 浅谈Lucene中的DocValues
- Lucene DocValues详解
- Lucene DocValues详解
- Fragment使用时出现 java.lang.IllegalStateException
- sbt编译出现(*:ssExtractDependencies) java.lang.IllegalStateException
- 使用okhttp3出现java.lang.IllegalStateException: closed
- Lucene 4.6.1 java.lang.IllegalStateException: TokenStream contract violation
- sendRedirect() IllegalStateException
- HttpURLConnection IllegalStateException
- MediaPlayer IllegalStateException
- java中文乱码
- 利用intent.setFlags 来跳转界面带来的好处
- Hive运行架构及配置部署
- 浩易南:线下手机销售维修店O2O思路
- Android Error 集合
- lucene升级至5.1版本出现 :IllegalStateException: IllegalStateException: unexpected docvalues type NONE"
- linux Sed 命令
- fragment复用:多个activity共用一个Fragment
- 一个form表单实现提交多个action
- prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc问题解决
- 【MySQL之字段类型(一)】MySQL中char和varchar的区别,以及varchar最大长度是多少?
- flex读取xml
- redis 搭建主从
- uva 10603倒水问题(搜索 隐式图的最短路 )