Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@apache.org Received: (qmail 70113 invoked from network); 7 Aug 2002 16:36:49 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 7 Aug 2002 16:36:49 -0000 Received: (qmail 20276 invoked by uid 97); 7 Aug 2002 16:37:13 -0000 Delivered-To: qmlist-jakarta-archive-lucene-dev@jakarta.apache.org Received: (qmail 20237 invoked by uid 97); 7 Aug 2002 16:37:12 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 20201 invoked by uid 98); 7 Aug 2002 16:37:11 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: IndexReader.lastModified() not correct X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Date: Wed, 7 Aug 2002 18:36:43 +0200 Message-ID: <50EA669584662B498F13A5F24630A0C002041A65@peach.mnet.private> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: IndexReader.lastModified() not correct Thread-Index: AcI+L+KON7GQ1hiKSZ6dtdtKaFF/2gAAApnw From: =?iso-8859-1?Q?Hal=E1csy_P=E9ter?= To: "Lucene Developers List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Scott! I don't know whether you code is good or not. My question is: can this = problem cause my exception? > java.io.IOException: read past EOF > at java.lang.Throwable.fillInStackTrace(Native Method) > at java.lang.Throwable.fillInStackTrace(Compiled Code) > at java.lang.Throwable.(Compiled Code) > at java.lang.Exception.(Compiled Code) > at java.io.IOException.(Compiled Code) > at=20 > org.apache.lucene.store.FSInputStream.readInternal(Compiled Code) > at=20 > org.apache.lucene.store.InputStream.readBytes(Compiled Code) >=20 I also cache the searcher. I think the searcher was not reopened and = tried to read something non-existing stuff peter > -----Original Message----- > From: Scott Ganyo [mailto:scott.ganyo@eTapestry.com] > Sent: Wednesday, August 07, 2002 6:32 PM > To: 'Lucene Developers List' > Subject: RE: IndexReader.lastModified() not correct >=20 >=20 > Ok. I've dug through all the code and although this isn't=20 > too pretty, it > looks to my untrained eye that this is probably the best way=20 > to implement a > corrected version that takes into consideration the deleted list. > Basically, it checks the "segments" file as before, then checks the > "segment.del" file in each segment, and takes the last time=20 > any of those > files were modified: >=20 > public static long lastModified(final Directory directory) throws > IOException { > synchronized (directory) { //=20 > in- & inter-process > sync > Long lastMod =3D (Long)new=20 > Lock.With(directory.makeLock("commit.lock")) > { > public Object doBody() throws IOException { > long last =3D directory.fileModified("segments"); //=20 > last add time > SegmentInfos infos =3D new SegmentInfos(); > infos.read(directory); > for (int i =3D 0; i < infos.size(); i++) { > String delFile =3D infos.info(i).name + ".del"; > if (directory.fileExists(delFile)) { > long lastDel =3D=20 > directory.fileModified(delFile); // last > delete time (per segment) > if (lastDel > last) last =3D lastDel; > } > } > return new Long(last); > } > }.run(); > return lastMod.longValue(); > } > } >=20 > Please let me know if I've missed any shortcuts or if you=20 > know of a better > way... >=20 > Scott >=20 > > -----Original Message----- > > From: Scott Ganyo [mailto:scott.ganyo@eTapestry.com] > > Sent: Wednesday, August 07, 2002 9:27 AM > > To: Lucene-Dev (E-mail) > > Subject: IndexReader.lastModified() not correct > >=20 > >=20 > > The current implementation of IndexReader.lastModified() does=20 > > not return the > > results I am expecting. Here is the implementation: > >=20 > > /** Returns the time the index in the named directory was=20 > > last modified. > > */ > > public static long lastModified(File directory) throws=20 > IOException { > > return FSDirectory.fileModified(directory, "segments"); > > } > >=20 > > The problem is that the "segments" file is apparently not=20 > > updated when just > > doing a delete from an index. This is causing me problems=20 > > because I am > > attempting to rely on on the lastModified() command for=20 > IndexSearcher > > caching. The only solution that I have thought of so far=20 > > (without changing > > other parts of Lucene) is to make the lastModified() command=20 > > look at all the > > files in the last segment for the last modified date. > >=20 > > Thoughts? > >=20 > > Thanks, > > Scott > >=20 >=20 -- To unsubscribe, e-mail: For additional commands, e-mail: