lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Mannix <jake.man...@gmail.com>
Subject Re: Sort memory usage
Date Wed, 03 Feb 2010 21:38:35 GMT
On Wed, Feb 3, 2010 at 1:33 PM, tsuraan <tsuraan@gmail.com> wrote:

> > The FieldCache loads per segment, and the NRT reader is reloading only
> > new segments from disk, so yes, it's "smarter" about this caching in this
> > case.
>
> Ok, so the cache is tied to the index, and not to any particular
> reader.  The actual FieldCacheImpl keeps a mapping from Reader to its
> terms, so are the cached values shared just because the Readers
> actually wrap the same Indices, so the termDocs for all the readers
> are actually almost entirely the same?
>

The FieldCache *is* tied to readers, but it's tied to the SegmentReaders
which
comprise an IndexReader.  When you call IndexReader.reload() or if you
call IndexWriter.getReader(), you make new SegmentReaders inside of the
outer IndexReader that you are looking at, and only the new ones need to
load up their parts of the FieldCache.  Segments which have already been
read have SegmentReader instances which stick around, and the cache
pieces which are keyed on them stay around as well.

  -jake

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message