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

Uwe Schindler edited comment on LUCENE-3788 at 2/15/12 10:53 AM:
-----------------------------------------------------------------

Additionally, DirectoryReader is exactly the abstraction you are requesting. 
Solr also needs commits, versions,.. - all from DirectoryReader. So your magic 
ParallelDirectoryReader sould simply subclass DirectoryReader (which, again, is 
abstract): Example code is here:

{code:java}
public class MagicDirectoryReader extends DirectoyReader {
  public MagicDirectoryReader(Directory dir, ParallelCompositeReader parallel) {
   super(dir, [Some casts/copying maybe needed] 
parallel.getSequentialSubReaders());
  }

  // override the rest of abstract methods to fake the commit/reopen-stuff for 
solr
}
{code}
                
      was (Author: thetaphi):
    Additionally, DirectoryReader is exactly the abstraction you are 
requesting. Solr also needs commits, versions,.. - all from DirectoryReader. So 
your magic ParallelDirectoryReader sould simply subclass DirectoryReader 
(which, again, is abstract): Example code is here:

{code:java}
public class MagicDirectoryReader extends DirectoyReader {
  public MagicDirectoryReader(Directory dir, ParallelCompositeReader parallel) {
   super(dir, [Some casts/copying maybe needed] 
parallel.getSequentialSubReaders());
  }

  // override the rest of abstract methods to fake the commit-stuff for solr
}
{code}
                  
> Separate getting Directory from IndexReader from its concrete subclasses
> ------------------------------------------------------------------------
>
>                 Key: LUCENE-3788
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3788
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/index
>            Reporter: Andrzej Bialecki 
>         Attachments: LUCENE-3788.patch
>
>
> Currently only subclasses of DirectoryReader expose the underlying Directory 
> via public final directory(). IMHO this aspect should be separated from 
> DirectoryReader so that other IndexReader implementations could expose any 
> underlying Directory if they wanted to. Specifically, I have a use case where 
> I'd like to expose a synthetic Directory view of resources used for 
> ParallelCompositeReader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to