开发者

Lucene creating duplicate indexes

开发者 https://www.devze.com 2023-02-20 03:15 出处:网络
I created an app using lucene. The server winded up throwing out of memory errors because I was new\'in up an IndexSeacher for every search in the app. The garbage collector couldn\'t keep up.

I created an app using lucene. The server winded up throwing out of memory errors because I was new'in up an IndexSeacher for every search in the app. The garbage collector couldn't keep up.

I just got done implementing a singleton approach and now there are multiple indexes being created.

Lucene creating duplicate indexes

Any clue why this is happening? IndexWrite开发者_C百科r is what I am keeping static. I get IndexSearchers from it.


You don't have multiple indexes, you just have multiple segments. Lucene splits the index up into segments over time, although you can compact it if you want.

See here and here for more info


You also probably want to "new up" one IndexSearcher and pass it around, seems like you are creating the index every time here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号