配置自定义Lucene Analyzer以接受某些停用词

时间:2013-04-02 18:39:09

标签: lucene analyzer stemming hippocms

我需要修改lucene分析器,以便能够识别“Ben”(荷兰语停止词)这个词。请进一步指导我。如何让Lucene Analyzer接受这个单词作为常用单词?

服务器的Repository.xml

<paramname="analyzer"value="org.hippoecm.repository.query.lucene.StandardHippoAnalyzer"/>

workspace.xml

<?xmlversion="1.0"encoding="UTF-8"?>
<Workspacename="default">
    <!--
        virtual file system of the workspace:
        class: FQN of class implementing the FileSystem interface
    -->
    <FileSystemclass="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem">
    </FileSystem>
    <!--
        persistence manager of the workspace:
        class: FQN of class implementing the PersistenceManager interface
    -->
    <PersistenceManagerclass="org.apache.jackrabbit.core.persistence.mem.InMemPersistenceManager">
    </PersistenceManager>
    <!--
        Search index and the file system it uses.
        class: FQN of class implementing the QueryHandler interface
    -->
    <SearchIndexclass="org.apache.jackrabbit.core.query.lucene.SearchIndex">
      <paramname="path"value="${wsp.home}/index"/>
    </SearchIndex>
</Workspace>

1 个答案:

答案 0 :(得分:4)

最简单的方法是:

将以下类复制到本地项目

http://svn.onehippo.org/repos/hippo/hippo-cms7/repository/tags/hippo-repository-2.24.02/engine/src/main/java/org/hippoecm/repository/query/lucene/StandardHippoAnalyzer.java

更改Java包和文件名。

删除可能会影响您的问题的停用词(请参阅上面的Java代码)。

更新您的repository.xml以将Analyzer与新包和类名

一起使用

删除现有的lucene索引并重新启动Hippo。

$ mvn clean package && mvn -Pcargo.run

应该这样做。

相关问题