[
https://issues.apache.org/jira/browse/LUCENE-1312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12607833#action_12607833
]
Jason Rutherglen commented on LUCENE-1312:
------------------------------------------
In order to simulate a different IndexReader per update using
InstantiatedIndexReader I wrote the following code. There must be some flaws
in it as it keeps on causing errors in SegmentMerger. I am overriding deleted
docs and max doc. Also the latest error, which I am sure is probably somehow
fixable.
{code}
public class OceanInstantiatedIndexReader extends InstantiatedIndexReader {
private int maxDoc;
private Set<Integer> deletedDocs;
public OceanInstantiatedIndexReader(int maxDoc, InstantiatedIndex index,
Set<Integer> deletedDocs) {
super(index);
this.maxDoc = maxDoc;
this.deletedDocs = deletedDocs;
}
public int maxDoc() {
return maxDoc;
}
public int numDocs() {
return maxDoc() - deletedDocs.size();
}
public boolean isDeleted(int n) {
if (n >= maxDoc) return true;
if (deletedDocs != null && deletedDocs.contains(n)) return true;
return false;
}
public boolean hasDeletions() {
return true;
}
}
{code}
{noformat}
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.lucene.store.instantiated.InstantiatedIndexReader.norms(InstantiatedIndexReader.java:276)
at org.apache.lucene.index.SegmentMerger.mergeNorms(SegmentMerger.java:693)
at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:136)
at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:111)
at org.apache.lucene.index.IndexWriter.addIndexes(IndexWriter.java:3045)
{noformat}
> InstantiatedIndexReader does not implement getFieldNames properly
> -----------------------------------------------------------------
>
> Key: LUCENE-1312
> URL: https://issues.apache.org/jira/browse/LUCENE-1312
> Project: Lucene - Java
> Issue Type: Bug
> Components: contrib/*
> Reporter: Jason Rutherglen
> Assignee: Karl Wettin
> Attachments: lucene-1312.patch, lucene-1312.patch, lucene-1312.patch,
> lucene-1312.patch, lucene-1312.patch
>
>
> Causes error in org.apache.lucene.index.SegmentMerger.mergeFields
--
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]