Package it.unimi.dsi.mg4j.query.nodes

Examples of it.unimi.dsi.mg4j.query.nodes.Weight


  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();
}
View Full Code Here

TOP

Related Classes of it.unimi.dsi.mg4j.query.nodes.Weight

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.