Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 51430 invoked from network); 28 Jul 2006 08:28:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jul 2006 08:28:45 -0000 Received: (qmail 60494 invoked by uid 500); 28 Jul 2006 08:28:38 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 60392 invoked by uid 500); 28 Jul 2006 08:28:38 -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 60381 invoked by uid 99); 28 Jul 2006 08:28:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2006 01:28:37 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of andyhugb@gmail.com designates 66.249.92.169 as permitted sender) Received: from [66.249.92.169] (HELO ug-out-1314.google.com) (66.249.92.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2006 01:28:36 -0700 Received: by ug-out-1314.google.com with SMTP id y2so603471uge for ; Fri, 28 Jul 2006 01:28:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=k9Y92pWG8lmZgtsN1Qa9rcpf/Ei37qod60Q7wAAQrZXA8/6TMH3nerCwv0UlDTTL5Fr2jVrqePbpAEo7dgf7Np9Zflfq18M6n8Sex2VK+1e2xOdREtmIZLG1QRC+Pj0Qiw6Mjj1qnkHqV1jA2aF11TI/zXJh3TxO0L3CiKKwtCQ= Received: by 10.66.242.20 with SMTP id p20mr8249700ugh; Fri, 28 Jul 2006 01:28:14 -0700 (PDT) Received: by 10.67.88.5 with HTTP; Fri, 28 Jul 2006 01:28:14 -0700 (PDT) Message-ID: <4f2c7c9b0607280128x8bbeb0cg870bae95995640f0@mail.gmail.com> Date: Fri, 28 Jul 2006 16:28:14 +0800 From: "hu andy" To: java-user@lucene.apache.org Subject: Re: Consult some information about adding index while searching In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2602_31121514.1154075294404" References: <4f2c7c9b0607271904q7d64b5bdu258b6055750e5f5b@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_2602_31121514.1154075294404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline These codes are written in C#,. There is a C# version of Lucene 1.9, which can be downloaded from http://www.dotlucene.net This implements the indexing . public void CreateIndex() { try { AddDirectory(directory); writer.Optimize(); writer.Close(); directory.Refresh(); } catch (Exception e) { fmLog.AddLog(fmLog.LogType.Error, Current.User.ID, e.Message ); return; } } This is a wrapper of IndexSearcher. At first , I want to use a singleton IndexSearcher. But then I found the updated document can't be retrieved immediately. So Every time I instantiate a new IndexSeacher, although it is inefficient. public class SingletonSearcher { SingletonSearcher searcher IndexSearcher indexSearcher = null; static Object o = typeof(SingletonSearcher); /// /// /// /// private SingletonSearcher(String indexPath) { try { indexSearcher = new IndexSearcher(indexPath); } catch (Exception e) { Console.WriteLine(e.Message); searcher = null; } } public static SingletonSearcher GetSearcher() { //lock (o) //{ // if (searcher == null) // searcher = new SingletonSearcher(Current.Server.Path); // return searcher; //} return new SingletonSearcher(Current.Server.Path); } public static Hits GetHits(Query query) { if (GetSearcher() == null) return null; else if (GetSearcher().indexSearcher == null) return null; return GetSearcher().indexSearcher.Search(query); } } 2006/7/28, Doron Cohen : > > > Yes, I have closed IndexWriter. But it doesn't work. > > This is strange... > Can you post a small version of your code that can be executed to show the > problem? > - Doron > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ------=_Part_2602_31121514.1154075294404--