lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Harwood (JIRA)" <>
Subject [jira] Commented: (LUCENE-1720) TimeLimitedIndexReader and associated utility class
Date Fri, 12 Feb 2010 12:58:28 GMT


Mark Harwood commented on LUCENE-1720:

bq. I also want to add a TestTimeLimitedIndexReader.

To simplify this I started down the route of making core's TestIndexReader subclassable for
testing any IndexReader wrappers such as ours.

This involves centralising all the "r=" calls into a single overridable
"getReader" method. The TimeLimitingIndexReader then becomes just this:

public class TestTimeLimitingIndexReader extends TestIndexReader{
	public TestTimeLimitingIndexReader(String name)	{
	public IndexReader getReader(Directory dir, boolean readOnly)
			throws CorruptIndexException, IOException	{
		return new TimeLimitedIndexReader( super.getReader(dir, readOnly));

Having done this there were some test failures - notably calls to SegmentReader.getOnlySegmentReader(IndexReader
reader) because it has a bunch of "instanceof" testing code that doesn't expect our wrapper.

This is a general Lucene issue. If we support Reader-wrapping as a concept (FilterIndexReader
certainly suggests this) then it might make sense to provide a method call to "getWrappedReader"
in the same way java.lang.Exception introduced a standard "getCause" method in java 1.4(?)
because prior to that unwrapping objects required specialised knowledge of each wrapper class.
This is perhaps another Jira issue and related changes to Junit tests.

I'll attach an updated patch with the Junit test that currently fails on these "instanceof"

> TimeLimitedIndexReader and associated utility class
> ---------------------------------------------------
>                 Key: LUCENE-1720
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>            Reporter: Mark Harwood
>            Assignee: Mark Harwood
>            Priority: Minor
>         Attachments:,,,, Lucene-1720.patch, LUCENE-1720.patch,,,,
> An alternative to TimeLimitedCollector that has the following advantages:
> 1) Any reader activity can be time-limited rather than just single searches e.g. the
document retrieve phase.
> 2) Times out faster (i.e. runaway queries such as fuzzies detected quickly before last
"collect" stage of query processing)
> Uses new utility timeout class that is independent of IndexReader.
> Initial contribution includes a performance test class but not had time as yet to work
up a formal Junit test.
> TimeLimitedIndexReader is coded as JDK1.5 but can easily be undone.

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:
For additional commands, e-mail:

View raw message