lucene 對多個索引的搜尋和多執行緒搜尋

2021-07-10 18:01:32 字數 881 閱讀 2862

1、如果應用程式架構由多個lucene索引組成,則可以通過mutltisearcher把所有索引搜尋。也可以通過parallelmultisearcher進行多執行緒搜尋。在單核的情況下,multisearcher比parallelmultisearcher效能更高。

2、multisearcher

搜尋2個搜尋,把動物按首字母在字母表中的位置分成2部分,一部分乙個索引

public class multisearchertest extends testcase

atomwriter.close();

//對2個索引進行搜尋}}

3、parallelmultisearcher多執行緒搜尋

1)把文件按26個字母切分為26個索引。伺服器端向客戶端提供2個rmi呼叫

public class searchserver

//為每個索引建立乙個indexsearcher物件

}    

//註冊可供客戶端呼叫服務的埠

//使用     multisearcher完成所有索引的搜尋  

searcher multisearcher=new multisearcher(searchables);

remotesearchable multiimpl=new remotesearchables(multisearcher);

//使用   parallelsearcher   完成搜尋 

remotesearchable parallelimpl=new remotesearchables(parallelsearcher);}}

2)客戶端

public class searchclient

//統計時間

//不要關閉searcher物件

}

Lucene在多個索引上進行搜尋

資訊源自 http blog.csdn.net caoxu1987728 archive 2008 04 27 2335730.aspx 如下 package com.lucene.search import org.apache.lucene.analysis.standard.standarda...

lucene搜尋索引

官方demo,裡面思路也算清晰,也可以執行 lucene 6.3.0建立索引 public class searchfiles string index index string field contents string queries null int repeat 0 boolean raw ...

關於Lucene以及索引和搜尋的流程

lucene的普及和成功的背後是因為它的簡單。因此,你不需要深入理解lucene的資訊索引和檢索工作方面的知識就可以開始使用。lucene提供了簡單但是強大的核心api去實現全文索引和檢索,你只需要掌握少數的類就能將lucene整合到應用中。剛接觸lucene的人可能會誤認為lucene是乙個檔案搜...