3

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

服务器的 Repository.xml

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

工作区.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>
4

1 回答 1

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 代码)。

更新您的 repository.xml 以使用带有新包和类名的分析器

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

$ mvn clean package && mvn -Pcargo.run

那应该这样做。

于 2013-04-02T20:58:45.730 回答