question: public void testRanking ( ) throws Exception { final int numDocs = atLeast ( 100 ) ; final int maxTopN = 5 ; final int maxSentenceLength = 10 ; final int maxNumSentences = 20 ; Directory dir = newDirectory ( ) ; indexAnalyzer = new MockAnalyzer ( random ( ) , MockTokenizer . SIMPLE , true ) ; RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , dir , indexAnalyzer ) ; Document document = new Document ( ) ; Field id = new StringField ( "id" , "" , Field . Store . NO ) ; Field body = new Field ( "body" , "" , fieldType ) ; document . add ( id ) ; document . add ( body ) ; for ( int i = 0 ; i < numDocs ; i ++ ) { StringBuilder bodyText = new StringBuilder ( ) ; int numSentences = TestUtil . nextInt ( random ( ) , 1 , maxNumSentences ) ; for ( int j = 0 ; j < numSentences ; j ++ ) { bodyText . append ( newSentence ( random ( ) , maxSentenceLength ) ) ; } body . setStringValue ( bodyText . toString ( ) ) ; id . setStringValue ( Integer . toString ( i ) ) ; iw . addDocument ( document ) ; } IndexReader ir = iw . getReader ( ) ; IndexSearcher searcher = newSearcher ( ir ) ; for ( int i = 0 ; i < numDocs ; i ++ ) { checkDocument ( searcher , i , maxTopN ) ; } iw . close ( ) ; ir . close ( ) ; dir . close ( ) ; }
target:  indexes a bunch of gibberish, and then highlights top(n). asserts that top(n) highlights is a subset of top(n+1) up to some max N