Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java	(revision 33651)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java	(revision 33652)
@@ -24,4 +24,6 @@
 import org.apache.log4j.Logger;
 
+import org.greenstone.atea.morphia.*;
+import dev.morphia.*;
 
 /** 
@@ -68,6 +70,11 @@
     private MongoClient mongo = null;
     private MongoDatabase database = null;
-    
-    
+
+    /** 
+     * Mongodb Client handle via morphia, which handles the ODM (object document mapper)
+     * for MongoDB
+    */
+    public Datastore datastore = null;
+	
     public MongoDBAccess() throws Exception {
 	boolean success = false;
@@ -141,4 +148,9 @@
 	this.database = mongo.getDatabase(DB_NAME); 
 	*/
+
+	Morphia morphia = new Morphia();
+	morphia.mapPackage("com.greenstone.atea.morphia");
+	datastore = morphia.createDatastore(mongo, DB_NAME);
+	datastore.ensureIndexes();
 	
     }
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/NutchTextDumpToMongoDB.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/NutchTextDumpToMongoDB.java	(revision 33651)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/NutchTextDumpToMongoDB.java	(revision 33652)
@@ -9,4 +9,8 @@
 import org.apache.commons.csv.*;
 import org.apache.log4j.Logger;
+
+//import org.bson.types.ObjectId;
+    
+import org.greenstone.atea.morphia.*;
 
 
@@ -223,9 +227,10 @@
 		String[] sentences = maoriTxtDetector.getAllSentences(text);
 		int totalSentences = sentences.length;
+		int numSentencesInMRI = 0;
 		ArrayList<SentenceInfo> singleSentences = maoriTxtDetector.getAllSentencesInfo(sentences);
 		ArrayList<SentenceInfo> overlappingSentences = maoriTxtDetector.getAllOverlappingSentencesInfo(sentences);
-		
-		WebpageInfo webpage = page.convertStoredDataToWebpageInfo(WEBPAGE_COUNTER,
-								     SITE_COUNTER,
+
+		WebpageInfo webpage = page.convertStoredDataToWebpageInfo(WEBPAGE_COUNTER/*new ObjectId()*/,
+								     this.siteID/*SITE_COUNTER*/,
 								     isMRI,
 								     totalSentences,
@@ -233,6 +238,14 @@
 								     overlappingSentences);
 
-		
-		mongodbAccess.insertWebpageInfo(webpage);
+		for(SentenceInfo si : singleSentences) {
+		    if(si.langCode.equals(MaoriTextDetector.MAORI_3LETTER_CODE)) {
+			numSentencesInMRI++;
+		    }
+		}
+		webpage.setMRISentenceCount(numSentencesInMRI);
+		webpage.setContainsMRI((numSentencesInMRI > 0));
+		
+		//mongodbAccess.insertWebpageInfo(webpage);
+		mongodbAccess.datastore.save(webpage);
 	    }
 	}
@@ -291,16 +304,21 @@
 	}
 	
-	//File geoLiteCityDatFile = new File(this.getClass().getResource("GeoLiteCity.dat").getFile());
-	//this.geoLocationCountryCode = getCountryCodeOfDomain(this.domainOfSite, geoLiteCityDatFile);
+	File geoLiteCityDatFile = new File(this.getClass().getClassLoader().getResource("GeoLiteCity.dat").getFile());
+	try {
+	    this.geoLocationCountryCode = Utility.getCountryCodeOfDomain(this.domainOfSite, geoLiteCityDatFile);
+	} catch(Exception e) {
+	    e.printStackTrace();
+	    this.geoLocationCountryCode = null;
+	}
 
 	int totalPages = pages.size();	
 
-	WebsiteInfo website = new WebsiteInfo(SITE_COUNTER, this.siteID, this.domainOfSite,
+	WebsiteInfo website = new WebsiteInfo(/*SITE_COUNTER,*/ this.siteID, this.domainOfSite,
 	      totalPages, this.countOfWebPagesWithBodyText, this.numPagesInMRI, 
 	      this.siteCrawledTimestamp, this.siteCrawlUnfinished, redoCrawl,
 	      this.geoLocationCountryCode, this.urlContainsLangCodeInPath);
 
-	mongodbAccess.insertWebsiteInfo(website);
-	
+	//mongodbAccess.insertWebsiteInfo(website);
+	mongodbAccess.datastore.save(website);
     }
 
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/TextDumpPage.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/TextDumpPage.java	(revision 33651)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/TextDumpPage.java	(revision 33652)
@@ -8,4 +8,5 @@
 import org.apache.log4j.Logger;
 
+import org.greenstone.atea.morphia.*;
 
 public class TextDumpPage {
@@ -178,5 +179,5 @@
      */
     public WebpageInfo convertStoredDataToWebpageInfo(
-      long webpageID, int websiteID, boolean isMRI, int totalSentences,
+      long webpageID, String siteID /*int websiteID*/, boolean isMRI, int totalSentences,
       ArrayList<SentenceInfo> singleSentences, ArrayList<SentenceInfo> overlappingSentences)
     {
@@ -188,5 +189,5 @@
 	String fetchTime = getFetchTime();
 
-	WebpageInfo webpage = new WebpageInfo(webpageID, websiteID,
+	WebpageInfo webpage = new WebpageInfo(webpageID, siteID/*websiteID,*/,
 					      pageText, pageURL, isMRI, totalSentences,
 					      charEncoding, modifiedTime, fetchTime,
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/TextLanguageDetector.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/TextLanguageDetector.java	(revision 33651)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/TextLanguageDetector.java	(revision 33652)
@@ -29,4 +29,6 @@
 import java.util.ArrayList;
 
+import org.greenstone.atea.morphia.*;
+
 /**
  * EXPORT OPENNLP_HOME environment variable to be your apache OpenNLP installation.
