lucene-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/LUCENE-1720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832987#action_12832987
] 

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= IndexReader.open(..)" calls into a single overridable
"getReader" method. The TimeLimitingIndexReader then becomes just this:

{code:title=TestTimeLimitingIndexReader.java|borderStyle=solid}
public class TestTimeLimitingIndexReader extends TestIndexReader{
	public TestTimeLimitingIndexReader(String name)	{
		super(name);
	}
	@Override
	public IndexReader getReader(Directory dir, boolean readOnly)
			throws CorruptIndexException, IOException	{
		return new TimeLimitedIndexReader( super.getReader(dir, readOnly));
	}	
}
{code}

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"
 checks







> TimeLimitedIndexReader and associated utility class
> ---------------------------------------------------
>
>                 Key: LUCENE-1720
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1720
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>            Reporter: Mark Harwood
>            Assignee: Mark Harwood
>            Priority: Minor
>         Attachments: ActivityTimedOutException.java, ActivityTimeMonitor.java, ActivityTimeMonitor.java,
ActivityTimeMonitor.java, Lucene-1720.patch, LUCENE-1720.patch, TestTimeLimitedIndexReader.java,
TestTimeLimitedIndexReader.java, TimeLimitedIndexReader.java, TimeLimitedIndexReader.java
>
>
> 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message