about RAMDirectory based B/S plantform problem hello, I just start to use lucene and become confused about RAMDirectory based lucene index establishment, the problem is one user use this RAM to establish index is ok, but, when it comes to multi user, the results is not correct. when i use synchronized{ writer.writeIndex (...)}, all go alright. but users have to wait. i mean, is that RAM can only be used in single thread, esp. writing the index? how to solve it in a B/S plantform?
============================ the detailed test code is like these, very simple, just use jsp: RAMDirectory idx=new RAMDirectory(); LuceneIndexWriterImpl writer=null; writer=LuceneIndexWriterImpl.getInstance(); //RAM-based lucene index establishment synchronized(wirter){ //if no synchronized the result is not correct writer.writeIndex(idx); } LuceneIndexReaderImpl luceneReader=new LuceneIndexReaderImpl(idx); .... .... out.println("****"); for(Integer id :documents.keySet()) out.println(id); out.println("****"); =========================== result: if only one user: out put is correct 7,3 but two users(if no synchronized): out put may be 0,0 and 4, 0 or other unexpected result. Regards Hilly