Package org.apache.nutch.searcher

Source Code of org.apache.nutch.searcher.LinkDbInlinks

/*
* Created on Nov 23, 2005
* Author: Andrzej Bialecki <ab@getopt.org>
*
*/
package org.apache.nutch.searcher;

import java.io.IOException;

import org.apache.nutch.crawl.Inlinks;
import org.apache.nutch.crawl.LinkDbReader;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.UTF8;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;

public class LinkDbInlinks implements HitInlinks {
 
  private LinkDbReader linkdb = null;
 
  public LinkDbInlinks(FileSystem fs, Path dir, Configuration conf) {
    linkdb = new LinkDbReader(fs, dir, conf);
  }

  public String[] getAnchors(HitDetails details) throws IOException {
    return linkdb.getAnchors(new UTF8(details.getValue("url")));
  }

  public Inlinks getInlinks(HitDetails details) throws IOException {
    return linkdb.getInlinks(new UTF8(details.getValue("url")));
  }

  public void close() throws IOException {
    if (linkdb != null) { linkdb.close(); }
  }

}
TOP

Related Classes of org.apache.nutch.searcher.LinkDbInlinks

TOP
Copyright © 2018 www.massapi.com. 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.