Package org.apache.nutch.crawl.UrlWithScore

Examples of org.apache.nutch.crawl.UrlWithScore.UrlScoreComparator


    assertEquals(1, compareBothRegularAndRaw(comp, k4, k1));
    assertEquals(1, compareBothRegularAndRaw(comp, k5, k1));
  }
 
  public void testUrlScoreSorting() throws IOException {
    UrlScoreComparator comp = new UrlScoreComparator();
   
    UrlWithScore k1 = new UrlWithScore("http://example.org/1", 1f);
    UrlWithScore k2 = new UrlWithScore("http://example.org/1", 2f);
    UrlWithScore k3 = new UrlWithScore("http://example.org/2", 1f);
    UrlWithScore k4 = new UrlWithScore("http://example.org/2", 2f);
    UrlWithScore k5 = new UrlWithScore("http://example.org/2", 3f);
   
    // k1 is after k2, because score is lower
    assertEquals(1, comp.compare(k1, k2));
    // test symmetry
    assertEquals(-1, comp.compare(k2, k1));
   
    // k1 is before k3, k4 and k5, because url is lower
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k3));
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k4));
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k5));
View Full Code Here


    assertEquals(1, compareBothRegularAndRaw(comp, k5, k1));
  }
 
  @Test
  public void testUrlScoreSorting() throws IOException {
    UrlScoreComparator comp = new UrlScoreComparator();
   
    UrlWithScore k1 = new UrlWithScore("http://example.org/1", 1f);
    UrlWithScore k2 = new UrlWithScore("http://example.org/1", 2f);
    UrlWithScore k3 = new UrlWithScore("http://example.org/2", 1f);
    UrlWithScore k4 = new UrlWithScore("http://example.org/2", 2f);
    UrlWithScore k5 = new UrlWithScore("http://example.org/2", 3f);
   
    // k1 is after k2, because score is lower
    assertEquals(1, comp.compare(k1, k2));
    // test symmetry
    assertEquals(-1, comp.compare(k2, k1));
   
    // k1 is before k3, k4 and k5, because url is lower
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k3));
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k4));
    assertEquals(-1, compareBothRegularAndRaw(comp, k1, k5));
View Full Code Here

TOP

Related Classes of org.apache.nutch.crawl.UrlWithScore.UrlScoreComparator

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.