[ 
https://issues.apache.org/jira/browse/LUCENE-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Smith updated LUCENE-2345:
------------------------------

    Attachment: LUCENE-2345_3.0.patch

Here's a patch against 3.0 that provides the SegmentReaderFactory ability
(not tested yet, but i'll be doing that shortly as i integrate this 
functionality)

It adds a SegmentReaderFactory.

The IndexWriter now has a getter and setter for setting this

SegmentReader has a new protected method init() which is called after the 
segment reader has been initialized (to allow subclasses to hook this action 
and do additional initialization, etc

added 2 new IndexReader.open() calls that allow specifying the 
SegmentReaderFactory



> Make it possible to subclass SegmentReader
> ------------------------------------------
>
>                 Key: LUCENE-2345
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2345
>             Project: Lucene - Java
>          Issue Type: Wish
>          Components: Index
>            Reporter: Tim Smith
>             Fix For: 3.1
>
>         Attachments: LUCENE-2345_3.0.patch
>
>
> I would like the ability to subclass SegmentReader for numerous reasons:
> * to capture initialization/close events
> * attach custom objects to an instance of a segment reader (caches, 
> statistics, so on and so forth)
> * override methods on segment reader as needed
> currently this isn't really possible
> I propose adding a SegmentReaderFactory that would allow creating custom 
> subclasses of SegmentReader
> default implementation would be something like:
> {code}
> public class SegmentReaderFactory {
>   public SegmentReader get(boolean readOnly) {
>     return readOnly ? new ReadOnlySegmentReader() : new SegmentReader();
>   }
>   public SegmentReader reopen(SegmentReader reader, boolean readOnly) {
>     return newSegmentReader(readOnly);
>   }
> }
> {code}
> It would then be made possible to pass a SegmentReaderFactory to IndexWriter 
> (for pooled readers) as well as to SegmentReader.get() (DirectoryReader.open, 
> etc)
> I could prepare a patch if others think this has merit
> Obviously, this API would be "experimental/advanced/will change in future"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to