lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Yu" <frank...@farpoint.com>
Subject RE: Thread Contention in Lucene.Net 2.9
Date Mon, 24 Jan 2011 18:35:01 GMT
Chris,

When the IndexSearcher gets created, it is read only:

IndexSearcher recordSearcher = new IndexSearcher(IndexMemory, true);

Later in the code, the IndexSearcher may get re-opened. My understanding is
that the IndexSearcher should be still read only even if it gets re-opened,
right?

IndexReader oldReader = recordSearcher.GetIndexReader();
if (!oldReader.IsCurrent())
{
      IndexReader newReader = oldReader.Reopen();
      if (oldReader!= newReader)
      {
          recordSearcher = new IndexSearcher(newReader);
      }
}

Thanks,

Frank

-----Original Message-----
From: Chris Woolum [mailto:cwoolum@moonvalley.com] 
Sent: Monday, January 24, 2011 11:14 AM
To: lucene-net-user@lucene.apache.org
Subject: RE: Thread Contention in Lucene.Net 2.9

Hey Frank,

Lucene does not use locks for the index reader. When you initialize the
index, are you loading it in as read only?

Chris      





Mime
View raw message