Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 7937 invoked from network); 8 Dec 2008 14:11:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Dec 2008 14:11:31 -0000 Received: (qmail 10789 invoked by uid 500); 8 Dec 2008 14:11:37 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 10758 invoked by uid 500); 8 Dec 2008 14:11:37 -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 10747 invoked by uid 99); 8 Dec 2008 14:11:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Dec 2008 06:11:37 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [82.111.253.243] (HELO mail.uk.scalix.com) (82.111.253.243) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Dec 2008 14:10:04 +0000 Received: from mail.uk.scalix.com (localhost.localdomain [127.0.0.1]) by mail.uk.scalix.com (8.13.8/8.13.8) with ESMTP id mB8EAnjB018290 for ; Mon, 8 Dec 2008 14:10:49 GMT Received: from [10.11.108.233] (dhow.uk.scalix.com [10.11.108.233]) by mail.uk.scalix.com (Scalix SMTP Relay 11.4.3.12322) via ESMTP; Mon, 08 Dec 2008 14:10:48 +0000 (GMT) Date: Mon, 8 Dec 2008 14:10:48 +0000 From: Chris Bamford To: java-user@lucene.apache.org Message-ID: <493D2AE8.9030601@scalix.com> In-Reply-To: <493D26AC.2040900@gmail.com> References: <493D105C.2030808@scalix.com> References: <493D2330.3080705@scalix.com> References: <493D26AC.2040900@gmail.com> Subject: Re: Open IndexReader read-only x-scalix-Hops: 1 User-Agent: Thunderbird 2.0.0.6 (X11/20070728) X-SMP-CT-RefID: str=0001.0A0B0205.493D2AE9.0024,ss=1,fgs=0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------010404000306060306070008" X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.uk.scalix.com X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE autolearn=ham version=3.2.5 --------------010404000306060306070008 Content-Type: text/plain; charset="US-ASCII"; format="flowed" Content-Disposition: inline Mark > Look for the static factory methods on IndexReader. I take it you mean IndexReader.open (dir, true) ? If so, how do I then pass that into DelayCloseIndexSearcher() so that I can continue to rely on all the existing calls like: IndexReader reader = contentSearcher.getIndexReader(); Put another way, how do I associate the static IndexReader with an IndexSearcher object so I can use getIndexReader() to get it again? Thanks for your continued help with this :-) Chris Mark Miller wrote: > Look for the static factory methods on IndexReader. > > - Mark > > Chris Bamford wrote: >> Thanks Mark. >> >> I have identified the spot where I need to do the surgery. However, >> I discover that IndexReader is abstract, but it seems crazy that I >> need to make a concrete class for which I have no need to add any of >> my own logic... Is there a suitable subclass I can use? The >> documented ones - FilterIndexReader, InstantiatedIndexReader, >> MultiReader, ParallelReader - all seem too complicated for what I >> need. My only requirement is to open it read-only! >> >> Am I missing something? >> >> Mark Miller wrote: >>> Chris Bamford wrote: >>>> >>>> So does that mean if you don't explicitly open an IndexReader, the >>>> IndexSearcher will do it for you? Or what? >>>> >>> Right. The IndexReader takes a Directory, and the IndexSearcher >>> takes an IndexReader - there are sugar constructors though - An >>> IndexSearcher will also accept a String file path, which will be >>> used to create a Directory which is used to create an IndexReader. >>> It will also take a Directory, which will be used to create an >>> IndexReader. It will also just accept the IndexReader. >>> >>> So you have to find how that IndexReader is being created (or where) >>> and change the code so that you get to create it, and when you do, >>> do it read-only. It should be easier than that roundabout info sounds. >>> >>> - Mark >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >>> For additional commands, e-mail: java-user-help@lucene.apache.org >>> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > -- Chris Bamford Senior Development Engineer *Scalix* chris.bamford@scalix.com Tel: +44 (0)1344 381814 www.scalix.com --------------010404000306060306070008--