[ 
https://issues.apache.org/jira/browse/LUCENE-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850361#action_12850361
 ] 

Tim Smith commented on LUCENE-2345:
-----------------------------------

bq. My patch removes loadTermsIndex method from SegmentReader and requires you 
to reopen it. 

that's definitely much cleaner and would solve the issue in my current patch 
(sadly i'm on 3.0 and want to keep my patch there at a minimum until i can port 
to all the goodness on 3.1).

bq. Also, they extend not only SegmentReader, but the whole hierarchy - SR, MR, 
DR, whatever.

i just wussed out and just did only the SegmentReader case as thats all i need 
right now

bq. as all the hooks are on the factory classes

could you post your factory class interface?
If i base my 3.0 patch off that i can reduce my 3.1 port overhead.


are there any tickets tracking your reopen refactors or your plugin model?
If not, feel free to retool this ticket for your plugin model for Index Readers 
as that will solve my use cases (and then some)

> 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, LUCENE-2345_3.0.plugins.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