You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by cu...@apache.org on 2005/09/01 20:35:16 UTC
svn commit: r265762 -
/lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java
Author: cutting
Date: Thu Sep 1 11:35:15 2005
New Revision: 265762
URL: http://svn.apache.org/viewcvs?rev=265762&view=rev
Log:
Use partitioner to get partition.
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java
Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java?rev=265762&r1=265761&r2=265762&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/searcher/FetchedSegments.java Thu Sep 1 11:35:15 2005
@@ -31,6 +31,8 @@
import org.apache.nutch.parse.*;
import org.apache.nutch.pagedb.*;
import org.apache.nutch.indexer.*;
+import org.apache.nutch.mapred.*;
+import org.apache.nutch.mapred.lib.*;
/** Implements {@link HitSummarizer} and {@link HitContent} for a set of
* fetched segments. */
@@ -44,6 +46,8 @@
private MapFile.Reader[] parseText;
private MapFile.Reader[] parseData;
+ private Partitioner partitioner = new HashPartitioner();
+
public Segment(NutchFileSystem nfs, File segmentDir) throws IOException {
this.nfs = nfs;
this.segmentDir = segmentDir;
@@ -93,7 +97,8 @@
// hash the url to figure out which part its in
private Writable getEntry(MapFile.Reader[] readers, UTF8 url,
Writable entry) throws IOException {
- return readers[url.hashCode()%readers.length].get(url, entry);
+ int part = partitioner.getPartition(url, null, readers.length);
+ return readers[part].get(url, entry);
}
}