2013-04-02 32 views
3

我需要修改lucene分析器,以便它能夠識別單詞「Ben」(荷蘭語停用詞)。請進一步指導我。我如何讓Lucene Analyzer接受這個單詞作爲常規單詞?配置自定義Lucene分析器以接受某些停用詞

用於服務器

的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> 

回答

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用分析儀與新包和類名

刪除您現有的Lucene索引,並重新啓動河馬。

$ mvn clean package && mvn -Pcargo.run 

這應該做到這一點。

+0

謝謝..如何從服務器中刪除現有的lucene索引? – user1901762

+0

在刪除它之前,應該停止應用程序容器。你應該有一個包含工作空間和索引的存儲目錄。此目錄的位置可能因您自己的配置/設置而異。 – Jeroen

相關問題