Hi,<div><br></div><div>just wanted to share this, although a final solution to the problem has not been found yet.</div><div><br></div><div>1)</div><div>LuceneSearcher today is creating the searcher object like this:</div>
<div><br></div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.36">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #931a68}
span.s2 {text-decoration: underline line-through}
span.s3 {text-decoration: underline}
</style>


<p class="p1">org.apache.lucene.search.Searcher searcher = <span class="s1">new</span> <span class="s2">IndexSearcher</span><span class="s3">(getConfig().getFulltextSearchIndexFile().getAbsolutePath())</span>;</p></div><div>
<br></div><div>This has the following disadvantages:</div><div>- It opens the searcher in read/write mode --> worse performance compared to read-only mode, and can cause LockException if two threads are instantiating the searcher object at the same time. (occurs only under high load).</div>
<div>- The constructor is deprecated</div><div><br></div><div>2)</div><div>The version I am using in my realm at this moment is the following:</div><div><br></div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.36">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #931a68}
span.s2 {text-decoration: underline line-through}
span.s3 {text-decoration: underline}
</style>


<p class="p1">org.apache.lucene.search.Searcher searcher = <span class="s1">new</span> <span class="s2">IndexSearcher</span><span class="s3">(getConfig().getFulltextSearchIndexFile().getAbsolutePath(), true)</span>;</p></div>
<div><br></div><div>Advantage:</div><div>- read-only mode, better performance and no LockExceptions</div><div><br></div><div>3)</div><div>With solution 2) I sometimes see an AlreadyClosedException in the logs. I now switched to a version which does not use any deprecated API anymore in the hope that the exception will disappear.</div>
<div><br></div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.36">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #0027cc}
</style>


<p class="p1">Directory directory = FSDirectory.open(<span class="s1">config</span>.getFulltextSearchIndexFile());<br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.36">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #931a68}
</style>


</p><p class="p1">IndexSearcher searcher = <span class="s1">new</span> IndexSearcher(directory, <span class="s1">true</span>);</p><p></p></div><div><br></div><div>The only question I still have is whether the directory object should get closed too.</div>
<div>Cheers</div><div>Balz</div>