Problem using same instance of indexSearcher for multiple requests

后端 未结 7 987
半阙折子戏
半阙折子戏 2020-11-30 14:47

Am using Lucene API in a .net web application. I want to use the same instance of Indexsearcher for all the requests.Hence am storing indexsearcher instance in http cache.<

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 15:11

    My quick answer is...

    You don't really need to use the same index searcher object for all request, in fact i would recommend against it. You only need to make sure there is only one thread updating the index.

    If you really want one, how about a static member variable in the application that is initialized once and used by all?

    The long answer is... I will try and find my code and see exactly how I handled the problem

提交回复
热议问题