lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject MemoryIndex(Reader), IndexReader, and SegmentReader
Date Fri, 15 Apr 2011 02:10:14 GMT
Hi,

Short version:
Should MemoryIndex (more precisely, MemoryIndexReader inside MemoryIndex.java) 
be using something like SegmentReader instead of extending IndexReader and 
hitting the exception below?

Background:
I'm working with some code that uses MemoryIndex and some nasty queries, some of 
which throw exceptions like the one below:

java.lang.UnsupportedOperationException: This reader does not support this 
method.
at org.apache.lucene.index.IndexReader.directory(IndexReader.java:612)
...
... some custom WildcardTermEnum classes ...
... some sustom SpanWildcardQuery classes ...
...
at 
org.apache.lucene.search.spans.SpanOrQuery$1.initSpanQueue(SpanOrQuery.java:176)
at org.apache.lucene.search.spans.SpanOrQuery$1.next(SpanOrQuery.java:188)
at 
org.apache.lucene.search.spans.NearSpansUnordered$SpansCell.next(NearSpansUnordered.java:84)

at 
org.apache.lucene.search.spans.NearSpansUnordered.initList(NearSpansUnordered.java:277)

at 
org.apache.lucene.search.spans.NearSpansUnordered.next(NearSpansUnordered.java:155)

at org.apache.lucene.search.spans.SpanScorer.<init>(SpanScorer.java:46)
at org.apache.lucene.search.spans.SpanWeight.scorer(SpanWeight.java:76)
at 
org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:298)

at 
org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:298)

at 
org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:298)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:514)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:332)
at org.apache.lucene.index.memory.MemoryIndex.search(MemoryIndex.java:421)

I did a bit of digging and I'm wondering if the following bit from 
MemoryIndex.java might be a problem:

  private final class MemoryIndexReader extends IndexReader {

This MemoryIndexReader doesn't override IndexReader's directory() method, which 
is where the above exception comes from:

  public Directory directory() {
    ensureOpen();
    throw new UnsupportedOperationException("This reader does not support this 
method.");  // line 612
  }

Thanks,
Otis

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message