lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: [jira] [Commented] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers
Date Mon, 10 Sep 2018 14:59:37 GMT
Adrien:

Answered from my cell phone while waiting in line so didn't look (or
know the code from memory), thanks!

Erick
On Mon, Sep 10, 2018 at 5:39 AM David Smiley (JIRA) <jira@apache.org> wrote:
>
>
>     [ https://issues.apache.org/jira/browse/LUCENE-8489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609118#comment-16609118
]
>
> David Smiley commented on LUCENE-8489:
> --------------------------------------
>
> Lets not double-up our constructors over this trivial matter.  If you'd rather _switch_
to a List then perhaps we can do that for 8.0.  Namgyu, was this an actual pain-point for
you in your Lucene usage?  Most users don't touch this low-level stuff.
>
> > Provide List type constructors for BaseCompositeReader based Readers
> > --------------------------------------------------------------------
> >
> >                 Key: LUCENE-8489
> >                 URL: https://issues.apache.org/jira/browse/LUCENE-8489
> >             Project: Lucene - Core
> >          Issue Type: Improvement
> >          Components: core/index
> >            Reporter: Namgyu Kim
> >            Priority: Major
> >              Labels: usability
> >         Attachments: LUCENE-8489.patch
> >
> >
> > Currently, Reader based on BaseCompositeReader(MultiReader, ParallelCompositeReader,
DirectoryReader) does not support List type constructor.
> > In fact, this does not make a big difference in performance, but users will think
positively if the API supports more variants.
> > I will add the following to support this.
> > 1) MultiReader
> > {code:java}
> > public MultiReader(List<IndexReader> subReaders) throws IOException {
> >   this(subReaders, true);
> > }
> > public MultiReader(List<IndexReader> subReaders, boolean closeSubReaders)
throws IOException {
> >   this(subReaders.toArray(new IndexReader[0]), closeSubReaders);
> > }
> > {code}
> > 2) ParallelCompositeReader
> > {code:java}
> > public ParallelCompositeReader(List<CompositeReader> readers) throws IOException
{
> >   this(true, readers);
> > }
> > public ParallelCompositeReader(boolean closeSubReaders, List<CompositeReader>
readers) throws IOException {
> >   this(closeSubReaders, readers, readers);
> > }
> > public ParallelCompositeReader(boolean closeSubReaders, List<CompositeReader>
readers, List<CompositeReader> storedFieldReaders) throws IOException {
> >   this(closeSubReaders, readers.toArray(new CompositeReader[0]), storedFieldReaders.toArray(new
CompositeReader[0]));
> > }
> > {code}
> > 3) DirectoryReader
> > {code:java}
> > protected DirectoryReader(Directory directory, List<LeafReader> segmentReaders)
throws IOException {
> >   super(segmentReaders);
> >   this.directory = directory;
> > }
> > {code}
> > 4) BaseCompositeReader
> > {code:java}
> > @SuppressWarnings("unchecked")
> > protected BaseCompositeReader(List<R> subReaders) throws IOException {
> >   this(subReaders.toArray((R[]) new IndexReader[subReaders.size()]));
> > }
> > {code}
> > 5) Test
> >  I wrote a test case in "TestParallelCompositeReader".
> > If you have any questions or requests, please left any comments :D
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v7.6.3#76005)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

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


Mime
View raw message