You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Rob Outar <ro...@ideorlando.org> on 2003/05/05 20:31:08 UTC

IndexReader.lastModified();

Hi all,

	I am experiencing a weird problem in Linux.  When I initially create the
index I store the date with the IndexReader.lastModified() call.  I then
have a Junit test that adds a document to the index, I then have a method
that checks if the index has changed and if it has I create a new
IndexSearcher.  The problem is the date the index was created and the most
recent call to IndexReader.lastModified()(after adding a document) are
returning the same value so when I query on the new document I just added it
is failing because according to the dates, the index has not changed so I
did not create a new IndexSearcher!!!

	Has anyone experience this before?  If so, is there a known fix?

Thanks,

Rob


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: IndexReader.lastModified();

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Tuesday 06 May 2003 05:42, Rob Outar wrote:
> Yeah it looks like I am going to have to handle it internally instead of
> relying on IndexReader.lastModified(), oh well so much for
> cross-platform-ism :-)

[regarding ext2-fs 'feature' on Linux]

I think this 'feature' might be useful thing to document in a FAQ. Perhaps 
there should be a platform-dependancies FAQ (or sub-section). Wasn't there 
also some concern regarding Windows platform, where deleted status of a file
was not reliably accessed by Java (or something similar)?

Also, do you think ext3 has same problem? (or if it has, other new journaling 
file systems).

-+ Tatu +-


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Rob Outar <ro...@ideorlando.org>.
Yeah it looks like I am going to have to handle it internally instead of
relying on IndexReader.lastModified(), oh well so much for
cross-platform-ism :-)


Thanks,

Rob


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Monday, May 05, 2003 4:12 PM
To: Lucene Users List
Subject: RE: IndexReader.lastModified();


Oh, I see what you mean.  You are talking about the delta between the
original time stamp, and the time stamp that you expect after you add a
document.  I thought you were saying that it takes the F/S at least a
second to update the time stamp, after the file has been modified.

In that case, this is a file system issue that Lucene can't do much
about.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> We looked it up on Goggle, ext2 file system does not update the last
> mod
> date if the change to the file is under 1 second.  Also I don't
> remember
> cause my brain hurts, when Linux returned the time it did not include
> ms,
> but on Windows it did, all my queries on Windows worked because of
> this.
>
> A sleep does not work, it is the modification time, of the file, not
> how
> long the test takes.
>
> Thanks,
>
> Rob
>
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, May 05, 2003 3:53 PM
> To: Lucene Users List
> Subject: RE: IndexReader.lastModified();
>
>
> I wouldn't trust that < 1 second statement :)
> Just put a sleep in your unit test and see.
>
> Otis
>
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > My Linux admin told me that if a change to a file occurs in less
> than
> > one
> > second Linux does not update the last mod date.  Has anyone else
> > experienced
> > this? or is this even possible?  I have spent hours and hours
> > debugging my
> > code and the date thing is the only thing I can see as causing my
> > queries to
> > fail.
> >
> >
> > Thanks,
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: Rob Outar [mailto:routar@ideorlando.org]
> > Sent: Monday, May 05, 2003 2:42 PM
> > To: Lucene Users List
> > Subject: RE: IndexReader.lastModified();
> >
> >
> >   /** Returns the time the index in the named directory was last
> > modified.
> > */
> >   public static long lastModified(File directory) throws
> IOException
> > {
> >     return FSDirectory.fileModified(directory, "segments");
> >   }
> >
> >   /** Returns the time the named file was last modified. */
> >   public final long fileModified(String name) throws IOException {
> >     File file = new File(directory, name);
> >     return file.lastModified();
> >   }
> >
> >   /** Returns the time the named file was last modified. */
> >   public static final long fileModified(File directory, String
> name)
> >        throws IOException {
> >     File file = new File(directory, name);
> >     return file.lastModified();
> >   }
> >
> > Could this be a problem in Linux where the files last mod date are
> > not being
> > updated fast enough?
> >
> > Thanks,
> >
> > Rob Outar
> > OneSAF A&I -- SAIC
> > Software\Data Engineer
> > 321-235-7660
> > outarr@saic.com <ma...@saic.com>
> >
> >
> > -----Original Message-----
> > From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> > Sent: Monday, May 05, 2003 2:37 PM
> > To: Lucene Users List
> > Subject: Re: IndexReader.lastModified();
> >
> >
> > I don't remember any more, but maybe lastModified() returns a new
> > value
> > only after the IndexWriter is close()d.  You may be able to tell
> from
> > looking at the source.... or you should just try that and see.
> >
> > Otis
> >
> >
> > --- Rob Outar <ro...@ideorlando.org> wrote:
> > > Hi all,
> > >
> > > 	I am experiencing a weird problem in Linux.  When I initially
> > create
> > > the
> > > index I store the date with the IndexReader.lastModified() call.
> I
> > > then
> > > have a Junit test that adds a document to the index, I then have
> a
> > > method
> > > that checks if the index has changed and if it has I create a new
> > > IndexSearcher.  The problem is the date the index was created and
> > the
> > > most
> > > recent call to IndexReader.lastModified()(after adding a
> document)
> > > are
> > > returning the same value so when I query on the new document I
> just
> > > added it
> > > is failing because according to the dates, the index has not
> > changed
> > > so I
> > > did not create a new IndexSearcher!!!
> > >
> > > 	Has anyone experience this before?  If so, is there a known fix?
> > >
> > > Thanks,
> > >
> > > Rob
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > lucene-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Oh, I see what you mean.  You are talking about the delta between the
original time stamp, and the time stamp that you expect after you add a
document.  I thought you were saying that it takes the F/S at least a
second to update the time stamp, after the file has been modified.

In that case, this is a file system issue that Lucene can't do much
about.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> We looked it up on Goggle, ext2 file system does not update the last
> mod
> date if the change to the file is under 1 second.  Also I don't
> remember
> cause my brain hurts, when Linux returned the time it did not include
> ms,
> but on Windows it did, all my queries on Windows worked because of
> this.
> 
> A sleep does not work, it is the modification time, of the file, not
> how
> long the test takes.
> 
> Thanks,
> 
> Rob
> 
> 
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, May 05, 2003 3:53 PM
> To: Lucene Users List
> Subject: RE: IndexReader.lastModified();
> 
> 
> I wouldn't trust that < 1 second statement :)
> Just put a sleep in your unit test and see.
> 
> Otis
> 
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > My Linux admin told me that if a change to a file occurs in less
> than
> > one
> > second Linux does not update the last mod date.  Has anyone else
> > experienced
> > this? or is this even possible?  I have spent hours and hours
> > debugging my
> > code and the date thing is the only thing I can see as causing my
> > queries to
> > fail.
> >
> >
> > Thanks,
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: Rob Outar [mailto:routar@ideorlando.org]
> > Sent: Monday, May 05, 2003 2:42 PM
> > To: Lucene Users List
> > Subject: RE: IndexReader.lastModified();
> >
> >
> >   /** Returns the time the index in the named directory was last
> > modified.
> > */
> >   public static long lastModified(File directory) throws
> IOException
> > {
> >     return FSDirectory.fileModified(directory, "segments");
> >   }
> >
> >   /** Returns the time the named file was last modified. */
> >   public final long fileModified(String name) throws IOException {
> >     File file = new File(directory, name);
> >     return file.lastModified();
> >   }
> >
> >   /** Returns the time the named file was last modified. */
> >   public static final long fileModified(File directory, String
> name)
> >        throws IOException {
> >     File file = new File(directory, name);
> >     return file.lastModified();
> >   }
> >
> > Could this be a problem in Linux where the files last mod date are
> > not being
> > updated fast enough?
> >
> > Thanks,
> >
> > Rob Outar
> > OneSAF A&I -- SAIC
> > Software\Data Engineer
> > 321-235-7660
> > outarr@saic.com <ma...@saic.com>
> >
> >
> > -----Original Message-----
> > From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> > Sent: Monday, May 05, 2003 2:37 PM
> > To: Lucene Users List
> > Subject: Re: IndexReader.lastModified();
> >
> >
> > I don't remember any more, but maybe lastModified() returns a new
> > value
> > only after the IndexWriter is close()d.  You may be able to tell
> from
> > looking at the source.... or you should just try that and see.
> >
> > Otis
> >
> >
> > --- Rob Outar <ro...@ideorlando.org> wrote:
> > > Hi all,
> > >
> > > 	I am experiencing a weird problem in Linux.  When I initially
> > create
> > > the
> > > index I store the date with the IndexReader.lastModified() call. 
> I
> > > then
> > > have a Junit test that adds a document to the index, I then have
> a
> > > method
> > > that checks if the index has changed and if it has I create a new
> > > IndexSearcher.  The problem is the date the index was created and
> > the
> > > most
> > > recent call to IndexReader.lastModified()(after adding a
> document)
> > > are
> > > returning the same value so when I query on the new document I
> just
> > > added it
> > > is failing because according to the dates, the index has not
> > changed
> > > so I
> > > did not create a new IndexSearcher!!!
> > >
> > > 	Has anyone experience this before?  If so, is there a known fix?
> > >
> > > Thanks,
> > >
> > > Rob
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > lucene-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Rob Outar <ro...@ideorlando.org>.
We looked it up on Goggle, ext2 file system does not update the last mod
date if the change to the file is under 1 second.  Also I don't remember
cause my brain hurts, when Linux returned the time it did not include ms,
but on Windows it did, all my queries on Windows worked because of this.

A sleep does not work, it is the modification time, of the file, not how
long the test takes.

Thanks,

Rob


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Monday, May 05, 2003 3:53 PM
To: Lucene Users List
Subject: RE: IndexReader.lastModified();


I wouldn't trust that < 1 second statement :)
Just put a sleep in your unit test and see.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> My Linux admin told me that if a change to a file occurs in less than
> one
> second Linux does not update the last mod date.  Has anyone else
> experienced
> this? or is this even possible?  I have spent hours and hours
> debugging my
> code and the date thing is the only thing I can see as causing my
> queries to
> fail.
>
>
> Thanks,
>
> Rob
>
>
> -----Original Message-----
> From: Rob Outar [mailto:routar@ideorlando.org]
> Sent: Monday, May 05, 2003 2:42 PM
> To: Lucene Users List
> Subject: RE: IndexReader.lastModified();
>
>
>   /** Returns the time the index in the named directory was last
> modified.
> */
>   public static long lastModified(File directory) throws IOException
> {
>     return FSDirectory.fileModified(directory, "segments");
>   }
>
>   /** Returns the time the named file was last modified. */
>   public final long fileModified(String name) throws IOException {
>     File file = new File(directory, name);
>     return file.lastModified();
>   }
>
>   /** Returns the time the named file was last modified. */
>   public static final long fileModified(File directory, String name)
>        throws IOException {
>     File file = new File(directory, name);
>     return file.lastModified();
>   }
>
> Could this be a problem in Linux where the files last mod date are
> not being
> updated fast enough?
>
> Thanks,
>
> Rob Outar
> OneSAF A&I -- SAIC
> Software\Data Engineer
> 321-235-7660
> outarr@saic.com <ma...@saic.com>
>
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, May 05, 2003 2:37 PM
> To: Lucene Users List
> Subject: Re: IndexReader.lastModified();
>
>
> I don't remember any more, but maybe lastModified() returns a new
> value
> only after the IndexWriter is close()d.  You may be able to tell from
> looking at the source.... or you should just try that and see.
>
> Otis
>
>
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > Hi all,
> >
> > 	I am experiencing a weird problem in Linux.  When I initially
> create
> > the
> > index I store the date with the IndexReader.lastModified() call.  I
> > then
> > have a Junit test that adds a document to the index, I then have a
> > method
> > that checks if the index has changed and if it has I create a new
> > IndexSearcher.  The problem is the date the index was created and
> the
> > most
> > recent call to IndexReader.lastModified()(after adding a document)
> > are
> > returning the same value so when I query on the new document I just
> > added it
> > is failing because according to the dates, the index has not
> changed
> > so I
> > did not create a new IndexSearcher!!!
> >
> > 	Has anyone experience this before?  If so, is there a known fix?
> >
> > Thanks,
> >
> > Rob
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I wouldn't trust that < 1 second statement :)
Just put a sleep in your unit test and see.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> My Linux admin told me that if a change to a file occurs in less than
> one
> second Linux does not update the last mod date.  Has anyone else
> experienced
> this? or is this even possible?  I have spent hours and hours
> debugging my
> code and the date thing is the only thing I can see as causing my
> queries to
> fail.
> 
> 
> Thanks,
> 
> Rob
> 
> 
> -----Original Message-----
> From: Rob Outar [mailto:routar@ideorlando.org]
> Sent: Monday, May 05, 2003 2:42 PM
> To: Lucene Users List
> Subject: RE: IndexReader.lastModified();
> 
> 
>   /** Returns the time the index in the named directory was last
> modified.
> */
>   public static long lastModified(File directory) throws IOException
> {
>     return FSDirectory.fileModified(directory, "segments");
>   }
> 
>   /** Returns the time the named file was last modified. */
>   public final long fileModified(String name) throws IOException {
>     File file = new File(directory, name);
>     return file.lastModified();
>   }
> 
>   /** Returns the time the named file was last modified. */
>   public static final long fileModified(File directory, String name)
>        throws IOException {
>     File file = new File(directory, name);
>     return file.lastModified();
>   }
> 
> Could this be a problem in Linux where the files last mod date are
> not being
> updated fast enough?
> 
> Thanks,
> 
> Rob Outar
> OneSAF A&I -- SAIC
> Software\Data Engineer
> 321-235-7660
> outarr@saic.com <ma...@saic.com>
> 
> 
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, May 05, 2003 2:37 PM
> To: Lucene Users List
> Subject: Re: IndexReader.lastModified();
> 
> 
> I don't remember any more, but maybe lastModified() returns a new
> value
> only after the IndexWriter is close()d.  You may be able to tell from
> looking at the source.... or you should just try that and see.
> 
> Otis
> 
> 
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > Hi all,
> >
> > 	I am experiencing a weird problem in Linux.  When I initially
> create
> > the
> > index I store the date with the IndexReader.lastModified() call.  I
> > then
> > have a Junit test that adds a document to the index, I then have a
> > method
> > that checks if the index has changed and if it has I create a new
> > IndexSearcher.  The problem is the date the index was created and
> the
> > most
> > recent call to IndexReader.lastModified()(after adding a document)
> > are
> > returning the same value so when I query on the new document I just
> > added it
> > is failing because according to the dates, the index has not
> changed
> > so I
> > did not create a new IndexSearcher!!!
> >
> > 	Has anyone experience this before?  If so, is there a known fix?
> >
> > Thanks,
> >
> > Rob
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> >
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Rob Outar <ro...@ideorlando.org>.
My Linux admin told me that if a change to a file occurs in less than one
second Linux does not update the last mod date.  Has anyone else experienced
this? or is this even possible?  I have spent hours and hours debugging my
code and the date thing is the only thing I can see as causing my queries to
fail.


Thanks,

Rob


-----Original Message-----
From: Rob Outar [mailto:routar@ideorlando.org]
Sent: Monday, May 05, 2003 2:42 PM
To: Lucene Users List
Subject: RE: IndexReader.lastModified();


  /** Returns the time the index in the named directory was last modified.
*/
  public static long lastModified(File directory) throws IOException {
    return FSDirectory.fileModified(directory, "segments");
  }

  /** Returns the time the named file was last modified. */
  public final long fileModified(String name) throws IOException {
    File file = new File(directory, name);
    return file.lastModified();
  }

  /** Returns the time the named file was last modified. */
  public static final long fileModified(File directory, String name)
       throws IOException {
    File file = new File(directory, name);
    return file.lastModified();
  }

Could this be a problem in Linux where the files last mod date are not being
updated fast enough?

Thanks,

Rob Outar
OneSAF A&I -- SAIC
Software\Data Engineer
321-235-7660
outarr@saic.com <ma...@saic.com>


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Monday, May 05, 2003 2:37 PM
To: Lucene Users List
Subject: Re: IndexReader.lastModified();


I don't remember any more, but maybe lastModified() returns a new value
only after the IndexWriter is close()d.  You may be able to tell from
looking at the source.... or you should just try that and see.

Otis


--- Rob Outar <ro...@ideorlando.org> wrote:
> Hi all,
>
> 	I am experiencing a weird problem in Linux.  When I initially create
> the
> index I store the date with the IndexReader.lastModified() call.  I
> then
> have a Junit test that adds a document to the index, I then have a
> method
> that checks if the index has changed and if it has I create a new
> IndexSearcher.  The problem is the date the index was created and the
> most
> recent call to IndexReader.lastModified()(after adding a document)
> are
> returning the same value so when I query on the new document I just
> added it
> is failing because according to the dates, the index has not changed
> so I
> did not create a new IndexSearcher!!!
>
> 	Has anyone experience this before?  If so, is there a known fix?
>
> Thanks,
>
> Rob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: IndexReader.lastModified();

Posted by Rob Outar <ro...@ideorlando.org>.
  /** Returns the time the index in the named directory was last modified.
*/
  public static long lastModified(File directory) throws IOException {
    return FSDirectory.fileModified(directory, "segments");
  }

  /** Returns the time the named file was last modified. */
  public final long fileModified(String name) throws IOException {
    File file = new File(directory, name);
    return file.lastModified();
  }

  /** Returns the time the named file was last modified. */
  public static final long fileModified(File directory, String name)
       throws IOException {
    File file = new File(directory, name);
    return file.lastModified();
  }

Could this be a problem in Linux where the files last mod date are not being
updated fast enough?

Thanks,

Rob Outar
OneSAF A&I -- SAIC
Software\Data Engineer
321-235-7660
outarr@saic.com <ma...@saic.com>


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Monday, May 05, 2003 2:37 PM
To: Lucene Users List
Subject: Re: IndexReader.lastModified();


I don't remember any more, but maybe lastModified() returns a new value
only after the IndexWriter is close()d.  You may be able to tell from
looking at the source.... or you should just try that and see.

Otis


--- Rob Outar <ro...@ideorlando.org> wrote:
> Hi all,
>
> 	I am experiencing a weird problem in Linux.  When I initially create
> the
> index I store the date with the IndexReader.lastModified() call.  I
> then
> have a Junit test that adds a document to the index, I then have a
> method
> that checks if the index has changed and if it has I create a new
> IndexSearcher.  The problem is the date the index was created and the
> most
> recent call to IndexReader.lastModified()(after adding a document)
> are
> returning the same value so when I query on the new document I just
> added it
> is failing because according to the dates, the index has not changed
> so I
> did not create a new IndexSearcher!!!
>
> 	Has anyone experience this before?  If so, is there a known fix?
>
> Thanks,
>
> Rob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: IndexReader.lastModified();

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I don't remember any more, but maybe lastModified() returns a new value
only after the IndexWriter is close()d.  You may be able to tell from
looking at the source.... or you should just try that and see.

Otis


--- Rob Outar <ro...@ideorlando.org> wrote:
> Hi all,
> 
> 	I am experiencing a weird problem in Linux.  When I initially create
> the
> index I store the date with the IndexReader.lastModified() call.  I
> then
> have a Junit test that adds a document to the index, I then have a
> method
> that checks if the index has changed and if it has I create a new
> IndexSearcher.  The problem is the date the index was created and the
> most
> recent call to IndexReader.lastModified()(after adding a document)
> are
> returning the same value so when I query on the new document I just
> added it
> is failing because according to the dates, the index has not changed
> so I
> did not create a new IndexSearcher!!!
> 
> 	Has anyone experience this before?  If so, is there a known fix?
> 
> Thanks,
> 
> Rob
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org