No! It's not like this in my code. This code opens an IndexReader every time
I call newIndexSearcher().
In my code it is sometime like -
IndexReader[] irs;
// irs is a global array containing IndexReaders which are opened when the
application starts
.
.
IndexSearcher[] getIndexSearchers(
like this?
public synchronized IndexSearcher newIndexSearcher() {
try {
// semaphore.acquire();
if (null == indexSearcher) {
Directory directory = FSDirectory.open(new
File(Config.DB_DIR+"/rssindex"));
indexSearcher = new IndexSearcher(IndexReader.open(directory, true));
} else {
Thanks Mike.
That solved a query which was itching my mind for a long time.
On Thu, Apr 22, 2010 at 4:41 PM, Michael McCandless <
luc...@mikemccandless.com> wrote:
> It's the IndexReader that's costly to open/warm, so ideally it should
> be opened once and shared.
>
> The Searchers do very little
It's the IndexReader that's costly to open/warm, so ideally it should
be opened once and shared.
The Searchers do very little on construction so re-creating per query
should be OK.
Mike
On Thu, Apr 22, 2010 at 6:38 AM, Samarendra Pratap wrote:
> Greetings to all.
> I have read at so many place
Greetings to all.
I have read at so many places that we should not open a Searcher for each
request for the sake of performance, but I have always been wondering
whether it is actually Searcher or Reader?
I have a group of index amounting to 23G which actually contains of
different index directo