public void tearDown() {
for( File f: new File( basename ).getParentFile().listFiles( (FileFilter)new PrefixFileFilter( new File( basename ).getName() ) ) ) f.delete();
}
public void testWeights() throws QueryBuilderVisitorException, IOException {
Query query = new Weight( 0.5, new And( new Term( "a" ), new Term( "b" ) ) );
DocumentIteratorBuilderVisitor documentIteratorBuilderVisitor = new DocumentIteratorBuilderVisitor( null, index, Integer.MAX_VALUE );
DocumentIterator documentIterator = query.accept( documentIteratorBuilderVisitor );
assertEquals( .5, documentIterator.weight(), 0 );
documentIterator.dispose();
query = new Weight( .1, new Weight( 0.5, new And( new Weight( .2, new Term( "a" ) ), new Term( "b" ) ) ) );
documentIteratorBuilderVisitor = new DocumentIteratorBuilderVisitor( null, index, Integer.MAX_VALUE );
documentIterator = query.accept( documentIteratorBuilderVisitor );
assertEquals( .5, documentIterator.weight(), 0 );
documentIterator.dispose();
}