[jira] [Updated] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers

JIRA jira@apache.org

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

Namgyu Kim updated LUCENE-8489:
-------------------------------
    Attachment: LUCENE-8489.patch

> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Updated] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers

Erick Erickson
Rather than proliferatw

On Sun, Sep 9, 2018, 10:27 Namgyu Kim (JIRA) <[hidden email]> wrote:

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

Namgyu Kim updated LUCENE-8489:
-------------------------------
    Attachment: LUCENE-8489.patch

> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Updated] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers

Erick Erickson
In reply to this post by JIRA jira@apache.org
Fat fingers.. rather than proliferate constructors, WDYT about a builder pattern?

On Sun, Sep 9, 2018, 10:27 Namgyu Kim (JIRA) <[hidden email]> wrote:

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

Namgyu Kim updated LUCENE-8489:
-------------------------------
    Attachment: LUCENE-8489.patch

> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Updated] (LUCENE-8489) Provide List type constructors for BaseCompositeReader based Readers

Adrien Grand
Erick,

Did you mean to reply on the JIRA issue rather than on the dev list? I don't think a builder pattern would work since this is an abstract class.

Le dim. 9 sept. 2018 à 21:15, Erick Erickson <[hidden email]> a écrit :
Fat fingers.. rather than proliferate constructors, WDYT about a builder pattern?

On Sun, Sep 9, 2018, 10:27 Namgyu Kim (JIRA) <[hidden email]> wrote:

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

Namgyu Kim updated LUCENE-8489:
-------------------------------
    Attachment: LUCENE-8489.patch

> 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: [hidden email]
For additional commands, e-mail: [hidden email]