lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 김선무 <guks...@gmail.com>
Subject IndexSearcher.doc thread safe problem
Date Wed, 09 Jul 2014 04:59:34 GMT
Hi all,

I know IndexSearcher is thread safe.
But IndexSearcher.doc is not thread safe maybe...

I try to below
--------------------------------------------
First, I extract docID at index directory. And that docID add on
queue(ConcurrentLinkedQueue)

Second, extract field value using docID poll at this queue after extract
process end. This process is  work to multi-threads.

For this I used the following summation code below:
searcher.search( query, filter, new Collector() { public void collect( int
doc ) { queue.add( docBase + doc ) } );
Thread thread1 = new Thread( () -> { while( !queue.isEmpty() ) {
System.out.println( searcher.doc(queue.poll()).get("content") ); } } );
Thread thread2 = new Thread( thread1 );
thread1.start();
thread2.start();
-------------------------------------------

Result was different in every execution.

My method is wrong? or IndexSearcher bug?

Please help me

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message