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 [EMAIL PROTECTED] HitSummarizer} and [EMAIL PROTECTED]
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);
}
}