Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/IndexerInterface.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/IndexerInterface.java	(revision 7475)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/IndexerInterface.java	(revision 7476)
@@ -16,5 +16,5 @@
   public int     getNumberOfPasses();
   // TODO: add a function call to provide appropriate XML for the service description
-    public boolean addServiceDescriptions(org.w3c.dom.Element service_rack_list);
+  public boolean addServiceDescriptions(org.w3c.dom.Element service_rack_list);
   public void    tidyup();
 
Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGPPIndexer.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGPPIndexer.java	(revision 7475)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGPPIndexer.java	(revision 7476)
@@ -11,8 +11,10 @@
 { 
   int          pass;
+  int          documentSeqNo;
   String       name;
   boolean      firstDocument;
   String       outputDirectory;
   String       outputStem;
+  String       passExtra;
   InputStream	 indexerFeedback;
   InputStream  indexerErrors;
@@ -20,4 +22,5 @@
   Process      mgpp_passes;
   static final String documentSeparator = "<Document>";
+  static final String sectionSeparator = "<Section>";
 
   public static final String MGPP_INDEX_TYPE = "mgpp";
@@ -25,4 +28,5 @@
   public MGPPIndexer(String name)
   { this.name = name;
+    this.passExtra = "";
   }
 
@@ -50,5 +54,12 @@
 
   public boolean addIndex(String name, String level, String field)
-  { return true;
+  { 
+    if (level == "doc_level") {
+      passExtra = " -J " + level;
+    }
+    else {
+      passExtra = " -K " + level;
+    }
+    return true;
   }
 
@@ -60,4 +71,8 @@
   public boolean indexDocument(DocumentID docID, DocumentInterface document)
   {
+    if (this.pass == 0) {
+      document.removeAllMetadata("gsdl3", "mgppseqno");
+    }
+
     if (!this.firstDocument)
     { // Send a '<document>' before the document itself
@@ -71,5 +86,7 @@
       }
     }
+
     String docText = document.getDocumentText();
+    int    startSeqNo = this.documentSeqNo;
     
     byte [] bytes = docText.getBytes();
@@ -113,5 +130,10 @@
     }
     this.firstDocument = false;
-    
+
+    if (this.pass == 0) {    
+      document.addDocumentMetadata("gsdl3", "mgppseqno", "dtx."+Integer.toString(startSeqNo));
+    }
+    this.documentSeqNo += 1;
+
     try {
       while (this.indexerErrors.available() > 0)
@@ -137,17 +159,18 @@
   { this.pass = passNumber;
     this.firstDocument = true;
+    this.documentSeqNo = 1;
     
     try {				
       switch (this.pass) {
         case 0:
-	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes -f " + this.outputStem + " -T1");
+	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes " + passExtra + " -f " + this.outputStem + " -T1");
 	break;
 	  
         case 1:
-	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes -f " + this.outputStem +" -T2");
+	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes " + passExtra + " -f " + this.outputStem +" -T2");
 	break;
 
         case 2:
-	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes -f " + this.outputStem +" -I1");
+	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes " + passExtra + " -f " + this.outputStem +" -I1");
 	break;
 
@@ -156,5 +179,5 @@
 	  p.waitFor();
 
-	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes -f " + this.outputStem +" -I2");
+	  mgpp_passes = Runtime.getRuntime().exec("mgpp_passes " + passExtra + " -f " + this.outputStem +" -I2");
 	break;
       }
@@ -264,12 +287,11 @@
    *  Return the number of passes required for this index.
    */
-    public int getNumberOfPasses()
-    { return 4;
-    }
-
-    public boolean addServiceDescriptions(org.w3c.dom.Element service_rack_list) {
-	System.out.println("adding service description, MGPPIndexer");
-	return true;
-    }
-
+  public int getNumberOfPasses()
+  { return 4;
+  }
+
+  public boolean addServiceDescriptions(org.w3c.dom.Element service_rack_list) {
+    System.out.println("adding service description, MGPPIndexer");
+    return true;
+  }
 }
