It's almost entirely trivial. Note that the IndexHandler is the name of my
singleton class....
Here's the meat of the class....
private static IndexSearcher indexSearcher;
public static synchronized IndexSearcher getSearcher()
throws Exception
{
if (IndexHandler.indexSearcher == null) {
IndexHandler.indexSearcher = new IndexSearcher(index);
}
return IndexHandler.indexSearcher;
}
and you call it by
IndexHandler.getSearcher().......
Erick
On 6/28/07, Kai Weber <[EMAIL PROTECTED]> wrote:
* Erick Erickson <[EMAIL PROTECTED]>:
> I guess I don't understand the problem. Can you build the documents
> from within a loop or not? If you can, it's simple...
>
> open indexwriter
> while (build a document)
> write to index
>
> close/optimize.
>
> Or are you saying that you can't build from within a loop?
Thats true, no loop.
I think I have to save the IndexWriter instance somewhere in application
scope or wrap it as a singleton.
Is there any example code I could reuse or learn from?
Kai
--
* http://www.glorybox.de/
PGP 1024D/594D4132 B693 5073 013F 7F56 5DCC D9C2 E6B5 448C 594D 4132
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]