【问题标题】:Configuring Custom Lucene Analyzer to accept certain stop words配置自定义 Lucene Analyzer 以接受某些停用词
【发布时间】:2013-04-02 18:39:09
【问题描述】:

我需要修改 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>

【问题讨论】:

    标签: lucene analyzer stemming hippocms


    【解决方案1】:

    最简单的方法是:

    将以下类复制到本地项目中

    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 以使用带有新包和类名的分析器

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

    $ mvn clean package && mvn -Pcargo.run
    

    应该可以的。

    【讨论】:

    • 谢谢.. 如何从服务器中删除现有的 lucene 索引?
    • 在删除它之前,您应该停止您的应用程序容器。您应该有一个包含工作空间和索引的存储目录。此目录的位置可能因您自己的配置/设置而异。
    猜你喜欢
    • 2013-10-05
    • 2022-01-19
    • 2013-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多