You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Namgyu Kim (JIRA)" <ji...@apache.org> on 2018/09/06 17:26:00 UTC

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

Namgyu Kim created LUCENE-8489:
----------------------------------

             Summary: 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


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 modify 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((IndexReader[]) subReaders.toArray(), 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, (CompositeReader[]) readers.toArray(), (CompositeReader[]) storedFieldReaders.toArray());
}
{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((R[]) subReaders.toArray());
}
{code}
5) Test
 I plan to write a test case in "TestParallelCompositeReader".
 After write the test case, I will upload the patch.

 

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