Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/BasePerJSON.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/BasePerJSON.java	(revision 31002)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/BasePerJSON.java	(revision 31002)
@@ -0,0 +1,29 @@
+package org.hathitrust.extractedfeatures;
+
+import org.apache.spark.util.DoubleAccumulator;
+
+public class BasePerJSON 
+{
+	private static final long serialVersionUID = 1L;
+
+	protected String _input_dir;
+	protected String _solr_url;
+	protected String _output_dir;
+	protected int    _verbosity;
+	
+	protected DoubleAccumulator _progress_accum;
+	protected double            _progress_step;
+	
+	public BasePerJSON(String input_dir, String solr_url, String output_dir, int verbosity, 
+					   DoubleAccumulator progress_accum, double progress_step)
+	{
+		_input_dir  = input_dir;
+		_solr_url   = solr_url;
+		_output_dir = output_dir;
+		_verbosity  = verbosity;
+		
+		_progress_accum = progress_accum;
+		_progress_step  = progress_step;
+	}
+}
+
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSON.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSON.java	(revision 31001)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSON.java	(revision 31002)
@@ -1,16 +1,6 @@
 package org.hathitrust.extractedfeatures;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.compress.compressors.CompressorException;
 import org.apache.spark.api.java.function.FlatMapFunction;
 import org.apache.spark.api.java.function.VoidFunction;
@@ -29,29 +19,14 @@
 
 
-class PagedJSON implements FlatMapFunction<String, JSONObject>, VoidFunction<JSONObject> 
+class PagedJSON extends BasePerJSON implements FlatMapFunction<String, JSONObject>
 //public class PagedJSON implements VoidFunction<String> 
 {
 	private static final long serialVersionUID = 1L;
-
-	protected String _input_dir;
-	protected String _solr_url;
-	protected String _output_dir;
-	protected int    _verbosity;
-	
-	DoubleAccumulator _progress_accum;
-	double            _progress_step;
 	
 	public PagedJSON(String input_dir, String solr_url, String output_dir, int verbosity, 
 					 DoubleAccumulator progress_accum, double progress_step)
 	{
-		_input_dir  = input_dir;
-		_solr_url   = solr_url;
-		_output_dir = output_dir;
-		_verbosity  = verbosity;
-		
-		_progress_accum = progress_accum;
-		_progress_step  = progress_step;
+		super(input_dir,solr_url,output_dir,verbosity,progress_accum,progress_step);
 	}
-	
 	
 	
@@ -125,36 +100,4 @@
 	}
 	
-	public void call(JSONObject solr_add_doc_json) 
-	{ 
-		String output_json_bz2 = solr_add_doc_json.getString("filename_json_bz2");
-		solr_add_doc_json.remove("filename_json_bz2");
-		
-		boolean random_test = (Math.random()>0.999); // every 1000
-		
-		if ((_verbosity >=2) && (random_test)) {
-			System.out.println("==================");
-			System.out.println("Sample output Solr add JSON [random test 1/1000]: " + solr_add_doc_json.toString());
-			System.out.println("==================");
-		}
-		
-					
-		if (_solr_url != null) {
-			if ((_verbosity >=2) && (random_test)) {
-				System.out.println("==================");
-				System.out.println("Posting to: " + _solr_url);
-				System.out.println("==================");
-			}
-			JSONSolrTransform.postSolrDoc(_solr_url, solr_add_doc_json);
-		}
-
-		if (_output_dir != null) {
-			if ((_verbosity >=2) && (random_test)) {
-				System.out.println("==================");
-				System.out.println("Saving to: " + _output_dir);
-				System.out.println("==================");
-			}
-			JSONSolrTransform.saveSolrDoc(solr_add_doc_json, _output_dir + "/" + output_json_bz2);
-		}
-	}
 	
 }
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSONForeach.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSONForeach.java	(revision 31002)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PagedJSONForeach.java	(revision 31002)
@@ -0,0 +1,67 @@
+package org.hathitrust.extractedfeatures;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.apache.spark.api.java.function.FlatMapFunction;
+import org.apache.spark.api.java.function.VoidFunction;
+import org.apache.spark.util.DoubleAccumulator;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+/*
+class PagedJSON implements Function<String, Boolean> {
+
+	private static final long serialVersionUID = 1L;
+
+	public Boolean call(String s) { return s.contains("a"); }
+}
+ */
+
+
+class PagedJSONForeach extends BasePerJSON implements VoidFunction<JSONObject> 
+//public class PagedJSON implements VoidFunction<String> 
+{
+	private static final long serialVersionUID = 1L;
+	
+	public PagedJSONForeach(String input_dir, String solr_url, String output_dir, int verbosity, 
+					 		DoubleAccumulator progress_accum, double progress_step)
+	{
+		super(input_dir,solr_url,output_dir,verbosity,progress_accum,progress_step);
+	}
+	
+	
+	public void call(JSONObject solr_add_doc_json) 
+	{ 
+		String output_json_bz2 = solr_add_doc_json.getString("filename_json_bz2");
+		solr_add_doc_json.remove("filename_json_bz2");
+		
+		boolean random_test = (Math.random()>0.999); // every 1000
+		
+		if ((_verbosity >=2) && (random_test)) {
+			System.out.println("==================");
+			System.out.println("Sample output Solr add JSON [random test 1/1000]: " + solr_add_doc_json.toString());
+			System.out.println("==================");
+		}
+		
+					
+		if (_solr_url != null) {
+			if ((_verbosity >=2) && (random_test)) {
+				System.out.println("==================");
+				System.out.println("Posting to: " + _solr_url);
+				System.out.println("==================");
+			}
+			JSONSolrTransform.postSolrDoc(_solr_url, solr_add_doc_json);
+		}
+
+		if (_output_dir != null) {
+			if ((_verbosity >=2) && (random_test)) {
+				System.out.println("==================");
+				System.out.println("Saving to: " + _output_dir);
+				System.out.println("==================");
+			}
+			JSONSolrTransform.saveSolrDoc(solr_add_doc_json, _output_dir + "/" + output_json_bz2);
+		}
+	}
+	
+}
+
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PerVolumeJSON.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PerVolumeJSON.java	(revision 31001)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/PerVolumeJSON.java	(revision 31002)
@@ -28,26 +28,12 @@
 
 
-public class PerVolumeJSON implements VoidFunction<String> 
+public class PerVolumeJSON extends BasePerJSON implements VoidFunction<String> 
 {
 	private static final long serialVersionUID = 1L;
-
-	protected String _input_dir;
-	protected String _solr_url;
-	protected String _output_dir;
-	protected int    _verbosity;
-	
-	DoubleAccumulator _progress_accum;
-	double            _progress_step;
 	
 	public PerVolumeJSON(String input_dir, String solr_url, String output_dir, int verbosity, 
 					 	 DoubleAccumulator progress_accum, double progress_step)
 	{
-		_input_dir  = input_dir;
-		_solr_url   = solr_url;
-		_output_dir = output_dir;
-		_verbosity  = verbosity;
-		
-		_progress_accum = progress_accum;
-		_progress_step  = progress_step;
+		super(input_dir,solr_url,output_dir,verbosity,progress_accum,progress_step);
 	}
 		
Index: other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/ProcessForSolrIngest.java
===================================================================
--- other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/ProcessForSolrIngest.java	(revision 31001)
+++ other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/extractedfeatures/ProcessForSolrIngest.java	(revision 31002)
@@ -100,5 +100,6 @@
 		JavaRDD<JSONObject> json_per_page_ids = json_list_data.flatMap(paged_json).cache();
 		
-		json_per_page_ids.foreach(paged_json);
+		PagedJSONForeach paged_json_foreach = new PagedJSONForeach(_input_dir,_solr_url,_output_dir,_verbosity, progress_accum,per_vol);
+		json_per_page_ids.foreach(paged_json_foreach);
 
 /*
