关键字:lucene.net 搜索排序 内存猛涨 内存溢出 IndexSearcher TopDocs weight/** *//** Creates a searcher searching the index in the named directory. */ public IndexSearcher(String path) throws IOException ...{ this(IndexReader.open(path), true); } /** *//** Creates a searcher searching the index in the provided directory. */ public IndexSearcher(Directory directory) throws IOException ...{ this(IndexReader.open(directory), true); } /** *//** Creates a searcher searching the provided index. */ public IndexSearcher(IndexReader r) ...{ this(r, false); }
public IndexSearcher(String path) throws IOException ...{
this(IndexReader.open(path), true);
} /** *//** Creates a searcher searching the index in the provided directory. */
public IndexSearcher(Directory directory) throws IOException ...{
this(IndexReader.open(directory), true);
} /** *//** Creates a searcher searching the provided index. */
public IndexSearcher(IndexReader r) ...{
this(r, false);
}
private IndexSearcher(IndexReader r, boolean closeReader) ...{
reader = r;
this.closeReader = closeReader;
}在lucene应用中也许很多人都遇到这种情况。当索引太大(大于10G),搜索时用前两种构造方法声明IndexSearcher对象,这样每构造一个IndexSearcher对象,都要声明一个索引对象(实际上是一个索引的多次连接),而每个索引对象都要占用一定量的系统资源(主要是内存)。当大量用户访问系统时,就会看到系统内存直线增长,致使产生“java heap space”内存耗尽或内存溢出(.net)。这个问题可以通过以下方法解决:终极解决方法:
联系方式: [email protected] , [email protected]