上一篇文章讲到lucene8和上述对应的iK分词器不兼容
然后我再网上下载了相应的源码自己改了下,直接引入到项目中:
修改前的源码如下:其实就是lucene8将方法:
createComponents(String fieldName, final Reader in) 改成了 createComponents(String fieldName)
所以相应的IK分词器的IKAnalyzer也要改
以下为IK分词器的一部分源代码:
/**
* IK 中文分词 版本 5.0.1
* IK Analyzer release 5.0.1
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under th