Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 92546 invoked from network); 1 Mar 2008 03:04:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Mar 2008 03:04:41 -0000 Received: (qmail 10965 invoked by uid 500); 1 Mar 2008 03:04:30 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 10941 invoked by uid 500); 1 Mar 2008 03:04:30 -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 10930 invoked by uid 99); 1 Mar 2008 03:04:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 19:04:30 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [77.67.121.29] (HELO mta01.zimbra.com) (77.67.121.29) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Mar 2008 03:03:45 +0000 Received: from dogfood.zimbra.com (dogfood.zimbra.com [10.10.140.44]) by mta01.zimbra.com (Postfix) with ESMTP id D7647DEA04F for ; Fri, 29 Feb 2008 19:03:59 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by dogfood.zimbra.com (Postfix) with ESMTP id D6C0B4BA6D for ; Fri, 29 Feb 2008 19:03:59 -0800 (PST) X-Virus-Scanned: amavisd-new at dogfood.zimbra.com Received: from dogfood.zimbra.com ([127.0.0.1]) by localhost (dogfood.zimbra.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lKqRyveJzzky for ; Fri, 29 Feb 2008 19:03:59 -0800 (PST) Received: from dogfood.zimbra.com (localhost.localdomain [127.0.0.1]) by dogfood.zimbra.com (Postfix) with ESMTP id 3EA514BA6B for ; Fri, 29 Feb 2008 19:03:59 -0800 (PST) Date: Fri, 29 Feb 2008 19:03:59 -0800 (PST) From: Tim Brennan To: java-user@lucene.apache.org Message-ID: <377418724.77401204340639049.JavaMail.root@dogfood.zimbra.com> In-Reply-To: <1936311142.77311204340164276.JavaMail.root@dogfood.zimbra.com> Subject: More IndexDeletionPolicy questions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Is there a direct way to ask an IndexReader what segment it is pointing at? That would make implementing custom deletion policies a LOT easier. It seems like it should be pretty simple -- keep a list of open IndexReaders, track what Segment files they're pointing to, and in onCommit don't delete those segments. Unfortunately it ends up being very difficult to directly determine what Segment an IndexReader is pointing to. Is there some straightforward way that I'm missing -- all I've managed to do so far is to remember the most recent one from onCommit/onInit and use that one....that works OK, but makes bootstrapping a pain if you try to open a Reader before you've opened the writer once. Also, when I use IndexReader.reopen(), can I assume that the newly returned reader is pointing at the "most recent" segment? I think so... Here's a sequence of steps that happen in my app: 0) open writer, onInit tells me that seg_1 is the most recent segment 1) Open reader, assume it is pointing to seg_1 from (0) 2) New write commits into seg_2, don't delete seg_1 b/c of (1) 3) Call reader.reopen() on the reader from (1)....new reader is pointing to seg_2 now? 4) seg_1 stays around until the next time I open or commit a writer, then it is removed. Does that seem reasonable? --tim --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org