You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Otis Gospodnetic <ot...@yahoo.com> on 2011/04/15 04:10:14 UTC
MemoryIndex(Reader), IndexReader, and SegmentReader
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