Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE012113C6 for ; Thu, 10 Jul 2014 01:55:55 +0000 (UTC) Received: (qmail 84219 invoked by uid 500); 10 Jul 2014 01:55:53 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 84158 invoked by uid 500); 10 Jul 2014 01:55:53 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 84145 invoked by uid 99); 10 Jul 2014 01:55:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2014 01:55:52 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of guksunm@gmail.com designates 209.85.219.52 as permitted sender) Received: from [209.85.219.52] (HELO mail-oa0-f52.google.com) (209.85.219.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2014 01:55:49 +0000 Received: by mail-oa0-f52.google.com with SMTP id j17so9042705oag.39 for ; Wed, 09 Jul 2014 18:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DwGsx98pzlnz8R2+0L4L9/uPaBhkfVNQBK95cYC22/w=; b=swJJzZwIfATeCP2v9ig86uImc/M++Mfp7TK+OLIwfIJCHx2vh0sY1rxNWAoPX4SRJN +zHsvCmRKZ4hNK72XWlNEXUHcucb7hTZEEDG3rKBsWhPDxGhbW4tv+yxg/b2SC89vtDD Gywgl4xIzfVSteLr0/k8HZtI/ZakCVd3ebl4fzUIHp26IkYa6L7Ql8Qs9up2XKN7Xypy UmptoNnN7DQ/StZlo9QJu493w4zBPrCuf8iDzs9qSJrV0KOcvK0jkHViPlE9Ettjjaal IX8zC/xxL8PlYgRc5AdG5A/2fvkAkMgD7SbJ6TIp/SIWfeyMxhLpb439+8CDZlGoIo9P Sawg== MIME-Version: 1.0 X-Received: by 10.60.52.77 with SMTP id r13mr50548258oeo.55.1404957324342; Wed, 09 Jul 2014 18:55:24 -0700 (PDT) Received: by 10.76.74.170 with HTTP; Wed, 9 Jul 2014 18:55:24 -0700 (PDT) In-Reply-To: References: Date: Thu, 10 Jul 2014 10:55:24 +0900 Message-ID: Subject: Re: IndexSearcher.doc thread safe problem From: =?UTF-8?B?6rmA7ISg66y0KHN1bm1vbywgS0lNKQ==?= To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a11330d023dfb4404fdcd1e08 X-Virus-Checked: Checked by ClamAV on apache.org --001a11330d023dfb4404fdcd1e08 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks answer Ian I more check this problem..(Lucene 4.8.1) 1. acceptsDocsOutOfOrder() return false =3D=3D> ineffective 2. acceptsDocsOutOfOrder() return true =3D=3D> ineffective 3. ConncurrentLinkedQueue add() and poll() methods check value in multi-thread =3D=3D> the queue is no problem. 4. Syncronized searcher.doc method call in multi-thread(like this: public synchronized Document getValue( IndexSearcher searcher, int docId ) { return searcher.doc( docId ); }) =3D=3D> every execution is same. but If I use this method, It is no difference with single thread performance. What do you think about it? Thanks 2014-07-10 2:04 GMT+09:00 Ian Lea : > It's more likely to be a demonstration that concurrent programming is > hard, results often hard to predict and debugging very hard. > > Or perhaps you simply need to add acceptsDocsOutOfOrder() to your > collector, returning false. > > Either way, hard to see any evidence of a thread-safety problem in lucene= . > > If adding acceptsDocsOutOfOrder() doesn't fix it, I suggest you verify > that your queue is getting the values you expect, in the order you > expect, consistently. Then worry about the display part, first > checking everything without any lucene calls. > > > -- > Ian. > > On Wed, Jul 9, 2014 at 5:59 AM, =EA=B9=80=EC=84=A0=EB=AC=B4 wrote: > > 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 extrac= t > > 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 =3D new Thread( () -> { while( !queue.isEmpty() ) { > > System.out.println( searcher.doc(queue.poll()).get("content") ); } } ); > > Thread thread2 =3D new Thread( thread1 ); > > thread1.start(); > > thread2.start(); > > ------------------------------------------- > > > > Result was different in every execution. > > > > My method is wrong? or IndexSearcher bug? > > > > Please help me > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --001a11330d023dfb4404fdcd1e08--