I'm synchronizing LUCENE-550 to support the new deletable IndexWriter. One of the features in this patch is the NotifiableIndex, a decorated layer that lets the consumer keep track of what is going on with the index.

In order for that to work I need to place the creation of the deleting IndexReader in a factory method, extended by NotifiableIndex.

As I'm not that in to the inner works of Directory/Segment, I wonder if someone could guide me a bit in the new code? I've identified this as what I need to change:

private final void maybeApplyDeletes(boolean doMerge) throws IOException {
    if (bufferedDeleteTerms.size() > 0) {

      for (int i = 0; i < infosEnd; i++) {
        IndexReader reader = null;
        try {
          reader = SegmentReader.get(segmentInfos.info(i));

I've introduced this method in my IndexWriterInterface:

  public IndexReader indexDeleterFactory() throws IOException

Could the reader per segment be replaced by one single MultiReader created by the original indexDeleterFactory()? Or are the segments partially the RAMDirectory of the writer, partially the persistent index?

If not, I have to come up with an alternative solution. The only thing I could think of is to invert the process:

public IndexReader decorateIndexDeleter(IndexReader indexReader) throws IOException

The default implementation would just return the same index reader as passed as parameter, but the if the IndexWriter was created via the NotifiableIndex#indexReaderFactory, the reader would decorated so I can pick up the delete-calls.

This is however an ugly solution.

I'm open to suggestion.


--
karl



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to