[
https://issues.apache.org/jira/browse/LUCENE-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12932326#action_12932326
]
Mark Miller commented on LUCENE-2766:
-------------------------------------
If you forgot about detection to start, and put it on the user to declare they
will keep segments in sync, then its pretty simple isn't it? Something like:
{code}
public IndexReader[] getSequentialSubReaders() {
if (!synchedSubReaders) {
return null;
} else {
int numReaders = readers.size();
IndexReader firstReader = readers.get(0);
IndexReader[] firstReaderSubReaders = firstReader
.getSequentialSubReaders();
IndexReader[] seqSubReaders;
if (firstReaderSubReaders != null) {
int segCnt = firstReaderSubReaders.length;
seqSubReaders = new IndexReader[segCnt];
try {
for (int j = 0; j < segCnt; j++) {
ParallelReader pr = new ParallelReader();
seqSubReaders[j] = pr;
for (int i = 0; i < numReaders; i++) {
IndexReader reader = readers.get(i);
IndexReader[] subs = reader.getSequentialSubReaders();
if (subs == null) {
return null;
}
pr.add(subs[j]);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return seqSubReaders;
}
return null;
}
}
{code}
> ParallelReader should support getSequentialSubReaders if possible
> -----------------------------------------------------------------
>
> Key: LUCENE-2766
> URL: https://issues.apache.org/jira/browse/LUCENE-2766
> Project: Lucene - Java
> Issue Type: Improvement
> Components: Index
> Reporter: Andrzej Bialecki
>
> Applications that need to use ParallelReader can't currently use per-segment
> optimizations because getSequentialSubReaders returns null.
> Considering the strict requirements on input indexes that ParallelReader
> already enforces it's usually the case that the additional indexes are built
> with the knowledge of the primary index, in order to keep the docId-s
> synchronized. If that's the case then it's conceivable that these indexes
> could be created with the same number of segments, which in turn would mean
> that their docId-s are synchronized on a per-segment level. ParallelReader
> should detect such cases, and in getSequentialSubReader it should return an
> array of ParallelReader-s created from corresponding segments of input
> indexes.
--
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: [email protected]
For additional commands, e-mail: [email protected]