Index: /indexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPRetrieveWrapper.java
===================================================================
--- /indexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPRetrieveWrapper.java	(revision 16348)
+++ /indexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPRetrieveWrapper.java	(revision 16349)
@@ -1,5 +1,5 @@
 /*
  *    MGPPRetrieveWrapper.java
- *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
+ *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -19,42 +19,21 @@
 package org.greenstone.mgpp;
 
-import java.util.Vector;
 
-/** java wrapper class for access to mgpp in C++
+
+/** java wrapper class for access to mgpp document retrieval mgpp in C++
  *
- * the native side implemented in MGPPWrapperImpl.cpp
- * uses MGPPQueryResult to hold the result of a query. the 
- * result of a getDocument is a String
- * uses the jni
+ * the native side is implemented in MGPPSearchWrapperImpl.cpp
+ * the result of getDocument is a String
+ * uses jni
  *
- *@see MGPPQueryResult
  */
 public class MGPPRetrieveWrapper {
   
-    /** the query result
-     * will be filled in by runQuery
-     */
-    protected MGPPQueryResult mgpp_query_result_=null; 
-    /** pointer to c++ MGPPWrapperData class - cached indexData and queryInfo
-     */
-    protected long mgpp_data_ptr_=0;
-
     static {
 	System.loadLibrary("mgppretrievejni");
-	initIDs();
     }
     
     public MGPPRetrieveWrapper() {
-	mgpp_query_result_ = new MGPPQueryResult();
-	initCppSide();
     }
-
-    /** initialises field and method IDs for java side to enable access on
-	C++ side */
-    //these two init methods and the load and unload methods are shared by search and retrieve
-    private static native void initIDs();
-
-    /** initialises the mgpp_data_ptr_ */
-    private native boolean initCppSide();
 
     /** returns a document: number docnum at level level 
@@ -67,60 +46,3 @@
 				     long docnum );
 
-    /** the public method - converts between utf-8 and unicode
-     */
-    // public String getDocument(String text_path,
-    //		      String level,
-    //		      long docnum ) {
-
-    //String utf8_doc = getUtF8Document(base_dir, text_path, level, docnum);
-	
-    /** load up the data structure for index 
-     * - maintains state between requests as can be slow  
-     * index_path should provide
-     * the absolute location of the mgpp index files eg ..../index/tt/demo 
-     */
-    public native boolean loadIndexData(String index_path);
-    /** unloads the data */
-    public native boolean unloadIndexData();
-
-    // query param methods
-//
-//    /** if on=true, sets default stemming on  - its off by default*/
-//    public native void setStem(boolean on);
-//    
-//    /** if on=true, sets default accentfolding on  - its off by default*/
-//    public native void setAccentFold(boolean on);
-//
-//   /** if on=true, sets default casefolding on - its off by default */
-//   public native void setCase(boolean on);
-//    /** default is 50 */
-//    public native void setMaxDocs(int num);
-//    /** if on=true, sorts by rank, otherwise returns in build order - 
-//	default is on */
-//    public native void setSortByRank(boolean on);
-//    /** if on=true, a query returns term freq info - default is on */
-//    public native void setReturnTerms(boolean on);
-//    /** sets the granularity of the  query  - default 'Document' */
-//    public native void setQueryLevel(String level);
-//    /** sets the granularity of the result - default 'Document' */
-//    public native void setReturnLevel(String level);
-//    /** sets the default boolean operator - AND(=1)/OR(=0) */
-//    public native void setMatchMode(int mode);
-//
-//    /** sets maxnumeric */
-//    public native void setMaxNumeric(int maxnumeric);
-//    /** returns a string with all the current query param settings */
-//    public native String getQueryParams();
-//
-//    /** actually carry out the query. Use the set methods to set any query
-//	params 
-//    * writes the result to query_result
-//    */
-//    public native void runQuery(String query_string); 
-//
-//    /** get the result out of the wrapper */
-//    public MGPPQueryResult getQueryResult() {
-//	return mgpp_query_result_;
-//    }
-//    
 }
Index: dexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPWrapper.java
===================================================================
--- /indexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPWrapper.java	(revision 16348)
+++ 	(revision )
@@ -1,108 +1,0 @@
-
-package org.greenstone.mgpp;
-
-import java.util.Vector;
-
-/** java wrapper class for access to mgpp in C++
- *
- * the native side implemented in MGPPWrapperImpl.cpp
- * uses MGPPQueryResult to hold the result of a query. the 
- * result of a getDocument is a String
- * uses the jni
- *
- *@see MGPPQueryResult
- */
-public class MGPPWrapper {
-  
-    /** the query result
-     * will be filled in by runQuery
-     */
-    protected MGPPQueryResult mgpp_query_result_=null; 
-    /** pointer to c++ MGPPWrapperData class - cached indexData and queryInfo
-     */
-    protected long mgpp_data_ptr_=0;
-
-    static {
-	System.loadLibrary("mgppjni");
-	initIDs();
-    }
-    
-    public MGPPWrapper() {
-	mgpp_query_result_ = new MGPPQueryResult();
-	initCppSide();
-    }
-
-    /** initialises field and method IDs for java side to enable access on
-	C++ side */
-    private static native void initIDs();
-
-    /** initialises the mgpp_data_ptr_ */
-    private native boolean initCppSide();
-
-    /** returns a document: number docnum at level level 
-     * text_path path should provide
-     * the absolute location of the mgpp text files eg ..../index/text/demo
-     * returns the doc in utf-8
-     */
-    public native String getDocument(String text_path,
-				     String level,
-				     long docnum );
-
-    /** the public method - converts between utf-8 and unicode
-     */
-    // public String getDocument(String text_path,
-    //		      String level,
-    //		      long docnum ) {
-
-    //String utf8_doc = getUtF8Document(base_dir, text_path, level, docnum);
-	
-    /** load up the data structure for index 
-     * - maintains state between requests as can be slow  
-     * index_path should provide
-     * the absolute location of the mgpp index files eg ..../index/tt/demo 
-     */
-    public native boolean loadIndexData(String index_path);
-    /** unloads the data */
-    public native boolean unloadIndexData();
-
-    // query param methods
-
-    /** if on=true, sets default stemming on  - its off by default*/
-    public native void setStem(boolean on);
-    
-    /** if on=true, sets default accentfolding on  - its off by default*/
-    public native void setAccentFold(boolean on);
-
-   /** if on=true, sets default casefolding on - its off by default */
-   public native void setCase(boolean on);
-    /** default is 50 */
-    public native void setMaxDocs(int num);
-    /** if on=true, sorts by rank, otherwise returns in build order - 
-	default is on */
-    public native void setSortByRank(boolean on);
-    /** if on=true, a query returns term freq info - default is on */
-    public native void setReturnTerms(boolean on);
-    /** sets the granularity of the  query  - default 'Document' */
-    public native void setQueryLevel(String level);
-    /** sets the granularity of the result - default 'Document' */
-    public native void setReturnLevel(String level);
-    /** sets the default boolean operator - AND(=1)/OR(=0) */
-    public native void setMatchMode(int mode);
-
-    /** sets maxnumeric */
-    public native void setMaxNumeric(int maxnumeric);
-    /** returns a string with all the current query param settings */
-    public native String getQueryParams();
-
-    /** actually carry out the query. Use the set methods to set any query
-	params 
-    * writes the result to query_result
-    */
-    public native void runQuery(String query_string); 
-
-    /** get the result out of the wrapper */
-    public MGPPQueryResult getQueryResult() {
-	return mgpp_query_result_;
-    }
-    
-}
Index: /indexers/trunk/mgpp/java/org/greenstone/mgpp/Makefile.in
===================================================================
--- /indexers/trunk/mgpp/java/org/greenstone/mgpp/Makefile.in	(revision 16348)
+++ /indexers/trunk/mgpp/java/org/greenstone/mgpp/Makefile.in	(revision 16349)
@@ -48,11 +48,12 @@
 compile: setup
 	$(JAVAC) -d $(JAVACLASSDIR) -sourcepath $(JAVASRCDIR) $(JAVACOPTIONS) *.java
-	$(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPWrapper
+#	$(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPWrapper
 	$(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPPassesWrapper
-
+	$(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPSearchWrapper
+	$(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPRetrieveWrapper	
 	$(JAR) cf $(MGPPHOME)/mgpp.jar -C $(JAVACLASSDIR) org
 
 clean:
-	rm -rf $(JAVACLASSDIR) $(MGPPHOME)/mgpp.jar $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPWrapper.h $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPPassesWrapper.h
+	rm -rf $(JAVACLASSDIR) $(MGPPHOME)/mgpp.jar $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPSearchWrapper.h $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPRetrieveWrapper.h $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPPassesWrapper.h
 
 install:
Index: /indexers/trunk/mgpp/java/org/greenstone/mgpp/Queryer.java
===================================================================
--- /indexers/trunk/mgpp/java/org/greenstone/mgpp/Queryer.java	(revision 16348)
+++ /indexers/trunk/mgpp/java/org/greenstone/mgpp/Queryer.java	(revision 16349)
@@ -6,10 +6,11 @@
 import java.io.File;
 /** Queryer - java port of c++ Queryer 
- * - uses MGPPWrapper to access mgpp
+ * - uses MGPPSearchWrapper and MGPPRetrieveWrapper to access mgpp
  * only has get document and search - full text browse not implemented
  *
  * run as:
  * java org.greenstone.mgpp.Queryer <basedir> <indexdir> <textdir>
- *@see MGPPWrapper
+ *@see MGPPSearchWrapper
+ *@see MGPPRetrieveWrapper
  */
 public class Queryer {
@@ -52,8 +53,9 @@
     index_path = base_dir  + File.separatorChar+ index_path;
 	
-    // the jni class to access mgpp stuff
-    MGPPWrapper wrapper = new MGPPWrapper();
-    wrapper.loadIndexData(index_path);
-	
+    // the jni classes to access mgpp stuff
+    MGPPSearchWrapper searcher = new MGPPSearchWrapper();
+    MGPPRetrieveWrapper retriever = new MGPPRetrieveWrapper();
+    searcher.loadIndexData(index_path);
+    
     // the return level
     String level = "Section";
@@ -83,5 +85,5 @@
 	  switch (x) {
 	  case 'q': // clean up and exit
-	    wrapper.unloadIndexData();
+	    searcher.unloadIndexData();
 	    return;  
 	  case 'h': // print help message
@@ -89,10 +91,10 @@
 	    break;
 	  case 'd': // print query param settings
-	    String info = wrapper.getQueryParams();
+	    String info = searcher.getQueryParams();
 	    System.out.println(info);
 	    break;
 	  case 'p': // print doc
 	    int docnum = Integer.parseInt(data);
-	    String doc = wrapper.getDocument(text_path, 
+	    String doc = retriever.getDocument(text_path, 
 					     level, docnum);
 	    System.out.println(doc);
@@ -100,12 +102,12 @@
 	  case 'm': //match docs
 	    int match = Integer.parseInt(data);
-	    wrapper.setMaxDocs(match);
+	    searcher.setMaxDocs(match);
 	    break;
 	  case 's': // set stem on/off
 	    int stem = Integer.parseInt(data);
 	    if (stem==0 ){
-	      wrapper.setStem(false);
+	      searcher.setStem(false);
 	    } else if(stem==1) {
-	      wrapper.setStem(true);
+	      searcher.setStem(true);
 	    } else {
 	      System.err.println("Error: stem should be 0 or 1");
@@ -115,7 +117,7 @@
 	    int casef = Integer.parseInt(data);
 	    if (casef==0) {
-	      wrapper.setCase(false);
+	      searcher.setCase(false);
 	    } else if (casef==1) {
-	      wrapper.setCase(true);
+	      searcher.setCase(true);
 	    } else {
 	      System.err.println("Error: case should be 0 or 1");
@@ -123,8 +125,8 @@
 	    break;
 	  case 'i': // set search level
-	    wrapper.setQueryLevel(data);
+	    searcher.setQueryLevel(data);
 	    break;
 	  case 'l': // set result level
-	    wrapper.setReturnLevel(data);
+	    searcher.setReturnLevel(data);
 	    level = data;
 	    break; 
@@ -132,7 +134,7 @@
 	    int rank = Integer.parseInt(data);
 	    if (rank==0) {
-	      wrapper.setSortByRank(false);
+	      searcher.setSortByRank(false);
 	    } else if (rank==1) {
-	      wrapper.setSortByRank(true);
+	      searcher.setSortByRank(true);
 	    } else {
 	      System.err.println("Error: rank should be 0 or 1");
@@ -142,5 +144,5 @@
 	    int type = Integer.parseInt(data);
 	    if (type==0 || type==1) {
-	      wrapper.setMatchMode(type);
+	      searcher.setMatchMode(type);
 	    } else {
 	      System.err.println("Error: type should be 0 (some) or 1 (all)");
@@ -161,6 +163,6 @@
 	else {
 	  // a query
-	  wrapper.runQuery(command);
-	  MGPPQueryResult res = wrapper.getQueryResult();
+	  searcher.runQuery(command);
+	  MGPPQueryResult res = searcher.getQueryResult();
 	  if (res.hasSyntaxError()) {
 	    System.out.println("invalid syntax error\n");
Index: /indexers/trunk/mgpp/jni/MGPPRetrieveWrapperImpl.cpp
===================================================================
--- /indexers/trunk/mgpp/jni/MGPPRetrieveWrapperImpl.cpp	(revision 16348)
+++ /indexers/trunk/mgpp/jni/MGPPRetrieveWrapperImpl.cpp	(revision 16349)
@@ -1,5 +1,5 @@
 /*
  *    MGPPRetrieveWrapperImpl.c
- *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
+ *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -17,156 +17,13 @@
  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */ 
+
 #ifdef __WIN32__
 #include <win32cfg.h>
-#include <strstream>
-#include <sstream>
-#else
-#ifdef __APPLE__
-#include <strstream>
-#include <sstream>
-#else
-#include <sstream>
-#endif
 #endif
 
 #include <jni.h>
 #include "org_greenstone_mgpp_MGPPRetrieveWrapper.h"
-#include "MGPPWrapperImpl.h"
 #include "TextGet.h"
-#include "GSDLQueryParser.h"
-#include "MGQuery.h"
-  
-MGPPWrapperData::MGPPWrapperData() {
-  indexData = new IndexData();
-  queryInfo = new QueryInfo();
 
-  if (queryInfo==NULL) {
-    cerr<<"couldn't allocate new query info\n";
-    if (indexData!=NULL) {
-      delete indexData;
-    }
-  }
-
-  // set all the default params
-  //SetCStr(queryInfo->docLevel, "Document"); // the level to search at
-  queryInfo->maxDocs = 50;
-  queryInfo->sortByRank = true;
-  queryInfo->exactWeights = false;
-  queryInfo->needRankInfo = true;
-  queryInfo->needTermFreqs = true;
-
-  UCArrayClear(level);
-  SetCStr(level, "Document"); // the level to return docs at
-  defaultStemMethod=0;
-  defaultBoolCombine=0;
-  maxNumeric = 4;
-}
-
-MGPPWrapperData::~MGPPWrapperData() { 
-  if (indexData !=NULL) {
-    delete indexData;
-  }
-  if (queryInfo !=NULL) {
-    delete queryInfo;
-  }
-}
-
-// ********************************************
-// initialisation stuff
-// ********************************************
-
-// cached ids for java stuff 
-jfieldID FID_mgpp_data = NULL; // MGPPWrapperData
-jfieldID FID_query_result = NULL; // MGPPQueryResult
-jmethodID MID_addDoc=NULL; // MGPPQueryResult.addDoc()
-jmethodID MID_addTerm=NULL; // MGPPQueryResult.addTerm()
-jmethodID MID_setTotalDocs=NULL; // MGPPQueryResult.setTotalDocs()
-jmethodID MID_clearResult=NULL; //MGPPQueryResult.clear()
-jmethodID MID_setSyntaxError=NULL; // MGPPQueryResult.setSyntaxError()
-jclass CID_String=NULL; // class ID of String
-
-/* to access objects and methods on java side, need their field/method ids - 
- this initialises them at the start to avoid recalculating them each time they
- are needed 
-Note: the descriptors need to be exactly right, otherwise you get an error 
-saying "no such field" but no reference to the fact that it has the right 
-name but the wrong type.
-Note: apparently the jclass is a local ref and should only work 
-in the method that created it. It seems to work ok, but I'll make it
- global cos the book said I should, and it may avoid future hassles.
-*/
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPRetrieveWrapper_initIDs (JNIEnv *j_env, jclass j_cls) {
-  
-  FID_mgpp_data = j_env->GetFieldID(j_cls, "mgpp_data_ptr_", "J"); //a long-"J"
-  if (FID_mgpp_data==NULL) {
-      cerr <<"MGPP JNI: field mgpp_data_ptr_ not found"<<endl;
-  } 
-
-  FID_query_result = j_env->GetFieldID(j_cls, "mgpp_query_result_", "Lorg/greenstone/mgpp/MGPPQueryResult;"); // an object -"L<class name>;"
-  if (FID_query_result==NULL) {
-      cerr <<"MGPP JNI: field mgpp_query_result_ not found"<<endl;
-  }
-  // the methods we want to use
-
-  // addDoc(long doc, float rank)
-  jclass JC_MGPPQueryResult = j_env->FindClass("org/greenstone/mgpp/MGPPQueryResult");
-  MID_addDoc = j_env->GetMethodID(JC_MGPPQueryResult, "addDoc", "(JF)V");
-  if (MID_addDoc==NULL) {
-      cerr <<"MGPP JNI: addDoc method not found"<<endl;
-  }
-  // addTerm(String term, String tag, int stem_method, long match_docs, 
-  // long term_freq, String[] equiv_terms)
-  MID_addTerm = j_env->GetMethodID(JC_MGPPQueryResult, "addTerm", "(Ljava/lang/String;Ljava/lang/String;IJJ[Ljava/lang/String;)V");
-  if (MID_addTerm==NULL) {
-      cerr <<"MGPP JNI: method addTerm not found"<<endl;
-  }
-  
-  // setTotalDocs(long)
-  MID_setTotalDocs = j_env->GetMethodID(JC_MGPPQueryResult, "setTotalDocs", "(J)V");
-  if (MID_setTotalDocs==NULL) {
-      cerr <<"MGPP JNI: method setTotalDocs not found"<<endl;
-  }
-  
-  MID_clearResult = j_env->GetMethodID(JC_MGPPQueryResult, "clear", "()V");
-  if (MID_clearResult==NULL) {
-      cerr <<"MGPP JNI: method clear not found"<<endl;
-  }
-  MID_setSyntaxError = j_env->GetMethodID(JC_MGPPQueryResult, "setSyntaxError", "(Z)V");
-  if (MID_clearResult==NULL) {
-      cerr <<"MGPP JNI: method setSyntaxError not found"<<endl;
-  }
-
-  // get the class for String to use in NewObjectArray in runQuery()
-  // FindClass returns a local reference - have to convert it to a global one
-  jclass local_CID_String = j_env->FindClass("java/lang/String");
-  if (local_CID_String==NULL) {
-    cerr <<"MGPP JNI: java String class not found"<<endl;
-  } else { 
-    /* create a global ref */
-    CID_String = (jclass)j_env->NewGlobalRef(local_CID_String);
-    /* The local reference is no longer useful */
-    j_env->DeleteLocalRef(local_CID_String);
- 
-    /* Is the global reference created successfully? */
-    if (CID_String == NULL) {
-      return; /* out of memory exception thrown */
-    }
-  }
-  
-}
-
-/* the java side MGPPWrapper has a pointer to a C++ object - MGPPWrapperData
-   initialise this and set the pointer 
-*/
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPRetrieveWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){
-
-  MGPPWrapperData * data = new MGPPWrapperData();
-  j_env->SetIntField(j_obj, FID_mgpp_data, (long)data);
-
-  return true;
-
-}
 
 //****************************************************
@@ -216,5 +73,5 @@
   td.UnloadData();
   
-  char * doc = GetCStr(docText); // do I need to free this char *??
+  char * doc = GetCStr(docText); 
   jstring result = j_env->NewStringUTF(doc);
   // release any gets
@@ -228,51 +85,2 @@
  
 }
-
-//******************************************
-// do a query
-// ****************************************
-
-/* load the IndexData - cached for querying
- */
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPRetrieveWrapper_loadIndexData (JNIEnv *j_env, jobject j_obj,  jstring j_index_name) {
-
-  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
-
-#ifdef __WIN32__
-  const char* base_dir = "";
-#else
-  const char* base_dir = "/";
-#endif
-
-  const char * index_name = j_env->GetStringUTFChars( j_index_name, NULL);
-  if (index_name==NULL) {
-    return false;
-  }
-  
-  jboolean j_result=false;
-  
-  // why doesn't this complain about const??
-  if (data->indexData->LoadData(base_dir, index_name)) {
-    j_result=true;
-  }
-  
-  // release any gets
-  j_env->ReleaseStringUTFChars(j_index_name, index_name);
-  
-  return j_result;
-}
-
-/* unload the data 
- */
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPRetrieveWrapper_unloadIndexData (JNIEnv *j_env, jobject j_obj) {
-
-  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
-
-  data->indexData->UnloadData();
-  return true;
-
-}
Index: /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.cpp
===================================================================
--- /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.cpp	(revision 16348)
+++ /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.cpp	(revision 16349)
@@ -1,5 +1,5 @@
 /*
- *    MGPPSearchWrapperImpl.c
- *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
+ *    MGPPSearchWrapperImpl.cpp
+ *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -32,10 +32,9 @@
 #include <jni.h>
 #include "org_greenstone_mgpp_MGPPSearchWrapper.h"
-#include "MGPPWrapperImpl.h"
-#include "TextGet.h"
+#include "MGPPSearchWrapperImpl.h"
 #include "GSDLQueryParser.h"
 #include "MGQuery.h"
   
-MGPPWrapperData::MGPPWrapperData() {
+MGPPSearchData::MGPPSearchData() {
   indexData = new IndexData();
   queryInfo = new QueryInfo();
@@ -63,5 +62,5 @@
 }
 
-MGPPWrapperData::~MGPPWrapperData() { 
+MGPPSearchData::~MGPPSearchData() { 
   if (indexData !=NULL) {
     delete indexData;
@@ -77,5 +76,5 @@
 
 // cached ids for java stuff 
-jfieldID FID_mgpp_data = NULL; // MGPPWrapperData
+jfieldID FID_mgpp_data = NULL; // MGPPSearchData
 jfieldID FID_query_result = NULL; // MGPPQueryResult
 jmethodID MID_addDoc=NULL; // MGPPQueryResult.addDoc()
@@ -157,5 +156,5 @@
 }
 
-/* the java side MGPPWrapper has a pointer to a C++ object - MGPPWrapperData
+/* the java side MGPPSearchWrapper has a pointer to a C++ object - MGPPSearchData
    initialise this and set the pointer 
 */
@@ -163,5 +162,5 @@
 Java_org_greenstone_mgpp_MGPPSearchWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){
 
-  MGPPWrapperData * data = new MGPPWrapperData();
+  MGPPSearchData * data = new MGPPSearchData();
   j_env->SetIntField(j_obj, FID_mgpp_data, (long)data);
 
@@ -180,5 +179,5 @@
 
   jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
+  MGPPSearchData * data = (MGPPSearchData *)data_ptr;
 
 #ifdef __WIN32__
@@ -212,5 +211,5 @@
 
   jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
+  MGPPSearchData * data = (MGPPSearchData *)data_ptr;
 
   data->indexData->UnloadData();
@@ -235,5 +234,5 @@
   
   // the query data
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   
   // the result to write to
@@ -246,5 +245,5 @@
   // clear the result
   j_env->CallVoidMethod(result_ptr, MID_clearResult);
-  exc = j_env->ExceptionOccurred(); // this catches teh exception I think - it
+  exc = j_env->ExceptionOccurred(); // this catches the exception I think - it
   //wont be thrown any further
   if (exc) {
@@ -262,5 +261,5 @@
     // invalid syntax
     j_env->CallVoidMethod(result_ptr, MID_setSyntaxError, true);
-    cerr << "MGPPWrapperImpl: invalid query syntax!!\n";
+    cerr << "MGPPSearchWrapperImpl: invalid query syntax!!\n";
     return; 
   }
@@ -336,5 +335,5 @@
 					      jobject j_obj, 
 					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   if (j_on) {
     data->defaultStemMethod |= 2;
@@ -349,5 +348,5 @@
 					      jobject j_obj, 
 					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   if (j_on) {
     data->defaultStemMethod |= 4;
@@ -362,5 +361,5 @@
 					      jobject j_obj, 
 					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
 
   if (j_on) {
@@ -375,5 +374,5 @@
 						 jobject j_obj, 
 						 jint j_max) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   data->queryInfo->maxDocs=j_max;
 }
@@ -383,5 +382,5 @@
 						 jobject j_obj, 
 						 jint j_max) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   data->maxNumeric=j_max;
 }
@@ -391,5 +390,5 @@
 						    jobject j_obj, 
 						    jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   
   data->queryInfo->sortByRank=j_on;
@@ -400,5 +399,5 @@
 						    jobject j_obj, 
 						    jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   data->queryInfo->needTermFreqs = j_on;
  
@@ -410,5 +409,5 @@
 						   jstring j_level){
   
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
 
   const char * level = j_env->GetStringUTFChars(j_level, NULL);
@@ -430,5 +429,5 @@
 						    jstring j_level){
 
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
 
   const char * level = j_env->GetStringUTFChars(j_level, NULL);
@@ -451,5 +450,5 @@
 						   jint j_mode){
 
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   data->defaultBoolCombine=j_mode;
 
@@ -460,5 +459,5 @@
 						     jobject j_obj){
 
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
+  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data);
   
   // print the data to a stringstream, then convert to char*, then to 
Index: /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.h
===================================================================
--- /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.h	(revision 16349)
+++ /indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.h	(revision 16349)
@@ -0,0 +1,35 @@
+/*
+ *    MGPPSearchWrapperImpl.h
+ *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */ 
+
+#include "MGQuery.h"
+
+// the global stuff we need to do a query
+class MGPPSearchData {
+ public:
+  IndexData * indexData;
+  QueryInfo * queryInfo;
+  int defaultStemMethod;
+  int defaultBoolCombine;
+  int maxNumeric;
+  UCArray level; // the return level
+
+  MGPPSearchData();
+  ~MGPPSearchData();
+
+};
Index: dexers/trunk/mgpp/jni/MGPPWrapperImpl.cpp
===================================================================
--- /indexers/trunk/mgpp/jni/MGPPWrapperImpl.cpp	(revision 16348)
+++ 	(revision )
@@ -1,524 +1,0 @@
-#ifdef __WIN32__
-#include <win32cfg.h>
-#include <strstream>
-#include <sstream>
-#else
-#ifdef __APPLE__
-#include <strstream>
-#include <sstream>
-#else
-#include <sstream>
-#endif
-#endif
-
-#include <jni.h>
-#include "org_greenstone_mgpp_MGPPWrapper.h"
-#include "MGPPWrapperImpl.h"
-#include "TextGet.h"
-#include "GSDLQueryParser.h"
-#include "MGQuery.h"
-  
-MGPPWrapperData::MGPPWrapperData() {
-  indexData = new IndexData();
-  queryInfo = new QueryInfo();
-
-  if (queryInfo==NULL) {
-    cerr<<"couldn't allocate new query info\n";
-    if (indexData!=NULL) {
-      delete indexData;
-    }
-  }
-
-  // set all the default params
-  SetCStr(queryInfo->docLevel, "Document"); // the level to search at
-  queryInfo->maxDocs = 50;
-  queryInfo->sortByRank = true;
-  queryInfo->exactWeights = false;
-  queryInfo->needRankInfo = true;
-  queryInfo->needTermFreqs = true;
-
-  UCArrayClear(level);
-  SetCStr(level, "Document"); // the level to return docs at
-  defaultStemMethod=0;
-  defaultBoolCombine=0;
-  maxNumeric = 4;
-}
-
-MGPPWrapperData::~MGPPWrapperData() { 
-  if (indexData !=NULL) {
-    delete indexData;
-  }
-  if (queryInfo !=NULL) {
-    delete queryInfo;
-  }
-}
-
-// ********************************************
-// initialisation stuff
-// ********************************************
-
-// cached ids for java stuff 
-jfieldID FID_mgpp_data = NULL; // MGPPWrapperData
-jfieldID FID_query_result = NULL; // MGPPQueryResult
-jmethodID MID_addDoc=NULL; // MGPPQueryResult.addDoc()
-jmethodID MID_addTerm=NULL; // MGPPQueryResult.addTerm()
-jmethodID MID_setTotalDocs=NULL; // MGPPQueryResult.setTotalDocs()
-jmethodID MID_clearResult=NULL; //MGPPQueryResult.clear()
-jmethodID MID_setSyntaxError=NULL; // MGPPQueryResult.setSyntaxError()
-jclass CID_String=NULL; // class ID of String
-
-/* to access objects and methods on java side, need their field/method ids - 
- this initialises them at the start to avoid recalculating them each time they
- are needed 
-Note: the descriptors need to be exactly right, otherwise you get an error 
-saying "no such field" but no reference to the fact that it has the right 
-name but the wrong type.
-Note: apparently the jclass is a local ref and should only work 
-in the method that created it. It seems to work ok, but I'll make it
- global cos the book said I should, and it may avoid future hassles.
-*/
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_initIDs (JNIEnv *j_env, jclass j_cls) {
-  
-  FID_mgpp_data = j_env->GetFieldID(j_cls, "mgpp_data_ptr_", "J"); //a long-"J"
-  if (FID_mgpp_data==NULL) {
-      cerr <<"MGPP JNI: field mgpp_data_ptr_ not found"<<endl;
-  } 
-
-  FID_query_result = j_env->GetFieldID(j_cls, "mgpp_query_result_", "Lorg/greenstone/mgpp/MGPPQueryResult;"); // an object -"L<class name>;"
-  if (FID_query_result==NULL) {
-      cerr <<"MGPP JNI: field mgpp_query_result_ not found"<<endl;
-  }
-  // the methods we want to use
-
-  // addDoc(long doc, float rank)
-  jclass JC_MGPPQueryResult = j_env->FindClass("org/greenstone/mgpp/MGPPQueryResult");
-  MID_addDoc = j_env->GetMethodID(JC_MGPPQueryResult, "addDoc", "(JF)V");
-  if (MID_addDoc==NULL) {
-      cerr <<"MGPP JNI: addDoc method not found"<<endl;
-  }
-  // addTerm(String term, String tag, int stem_method, long match_docs, 
-  // long term_freq, String[] equiv_terms)
-  MID_addTerm = j_env->GetMethodID(JC_MGPPQueryResult, "addTerm", "(Ljava/lang/String;Ljava/lang/String;IJJ[Ljava/lang/String;)V");
-  if (MID_addTerm==NULL) {
-      cerr <<"MGPP JNI: method addTerm not found"<<endl;
-  }
-  
-  // setTotalDocs(long)
-  MID_setTotalDocs = j_env->GetMethodID(JC_MGPPQueryResult, "setTotalDocs", "(J)V");
-  if (MID_setTotalDocs==NULL) {
-      cerr <<"MGPP JNI: method setTotalDocs not found"<<endl;
-  }
-  
-  MID_clearResult = j_env->GetMethodID(JC_MGPPQueryResult, "clear", "()V");
-  if (MID_clearResult==NULL) {
-      cerr <<"MGPP JNI: method clear not found"<<endl;
-  }
-  MID_setSyntaxError = j_env->GetMethodID(JC_MGPPQueryResult, "setSyntaxError", "(Z)V");
-  if (MID_clearResult==NULL) {
-      cerr <<"MGPP JNI: method setSyntaxError not found"<<endl;
-  }
-
-  // get the class for String to use in NewObjectArray in runQuery()
-  // FindClass returns a local reference - have to convert it to a global one
-  jclass local_CID_String = j_env->FindClass("java/lang/String");
-  if (local_CID_String==NULL) {
-    cerr <<"MGPP JNI: java String class not found"<<endl;
-  } else { 
-    /* create a global ref */
-    CID_String = (jclass)j_env->NewGlobalRef(local_CID_String);
-    /* The local reference is no longer useful */
-    j_env->DeleteLocalRef(local_CID_String);
- 
-    /* Is the global reference created successfully? */
-    if (CID_String == NULL) {
-      return; /* out of memory exception thrown */
-    }
-  }
-  
-}
-
-/* the java side MGPPWrapper has a pointer to a C++ object - MGPPWrapperData
-   initialise this and set the pointer 
-*/
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){
-
-  MGPPWrapperData * data = new MGPPWrapperData();
-  j_env->SetIntField(j_obj, FID_mgpp_data, (long)data);
-
-  return true;
-
-}
-
-//****************************************************
-// retrieve a document
-//****************************************************
-
-/* returns a document from mgpp as a string
-Note: TextData isn't cached - just reloaded each time
-*/
-JNIEXPORT jstring JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_getDocument (JNIEnv *j_env, 
- jobject j_obj, jstring j_text_name, jstring j_level, jlong j_docnum) {
-  
-#ifdef __WIN32__
-  const char* base_dir = "";
-#else
-  const char* base_dir = "/";
-#endif
-
-  const char * text_name = j_env->GetStringUTFChars(j_text_name, NULL);
-  if (text_name==NULL) {
-   return NULL;
-  }
-
-  const char * level = j_env->GetStringUTFChars( j_level, NULL);
-  if (level==NULL) {
-   j_env->ReleaseStringUTFChars(j_text_name, text_name);
-   return NULL;
-  }
-    
-  // does this work alright? j_docnum is a long (64 bit)
-  unsigned long docnum = j_docnum;
-  TextData td;
-
-  // cast to char* otherwise complains about const
-  td.LoadData((char *)base_dir, (char *)text_name);
-
-  UCArray mg_level;
-  SetCStr(mg_level, level);
-  UCArray docText;
-  docText.clear();
-  // get the actual text
-  if (!GetDocText(td, mg_level, docnum, docText)) {
-    cerr <<"MGPP JNI: couldn't retrieve doc text"<<endl;
-  }
-
-  td.UnloadData();
-  
-  char * doc = GetCStr(docText); // do I need to free this char *??
-  jstring result = j_env->NewStringUTF(doc);
-  // release any gets
-  j_env->ReleaseStringUTFChars(j_text_name, text_name);
-  j_env->ReleaseStringUTFChars(j_level, level);
-
-  // free any C++ stuff
-  delete doc;
-
-  return result;
- 
-}
-
-//******************************************
-// do a query
-// ****************************************
-
-/* load the IndexData - cached for querying
- */
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_loadIndexData (JNIEnv *j_env, jobject j_obj,  jstring j_index_name) {
-
-  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
-
-#ifdef __WIN32__
-  const char* base_dir = "";
-#else
-  const char* base_dir = "/";
-#endif
-
-  const char * index_name = j_env->GetStringUTFChars( j_index_name, NULL);
-  if (index_name==NULL) {
-    return false;
-  }
-  
-  jboolean j_result=false;
-  
-  // why doesn't this complain about const??
-  if (data->indexData->LoadData(base_dir, index_name)) {
-    j_result=true;
-  }
-  
-  // release any gets
-  j_env->ReleaseStringUTFChars(j_index_name, index_name);
-  
-  return j_result;
-}
-
-/* unload the data 
- */
-JNIEXPORT jboolean JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_unloadIndexData (JNIEnv *j_env, jobject j_obj) {
-
-  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data);
-  MGPPWrapperData * data = (MGPPWrapperData *)data_ptr;
-
-  data->indexData->UnloadData();
-  return true;
-
-}
-
-/* do the actual query - the results are written to query_result held on the 
-   java side */
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_runQuery (JNIEnv *j_env, jobject j_obj, jstring j_query){
-  
-  jthrowable exc; // an exception - check if something funny has happened
-  const char *query = j_env->GetStringUTFChars(j_query, NULL);
-  if (query==NULL) {
-    return; // exception already thrown
-  }
-  // turn to UCArray for mgpp and then release the string
-  UCArray queryArray;
-  SetCStr(queryArray, query);
-  j_env->ReleaseStringUTFChars(j_query, query);
-  
-  // the query data
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  
-  // the result to write to
-  jobject result_ptr = j_env->GetObjectField(j_obj, FID_query_result);
-  if (result_ptr==NULL) {
-    cerr <<"couldn't access the result to write to"<<endl;
-    return;
-  }
-  
-  // clear the result
-  j_env->CallVoidMethod(result_ptr, MID_clearResult);
-  exc = j_env->ExceptionOccurred(); // this catches teh exception I think - it
-  //wont be thrown any further
-  if (exc) {
-    j_env->ExceptionDescribe();
-    return;
-  }
-  // the mgpp QueryResult that we will use
-  ExtQueryResult queryResult;
-
-  QueryNode * queryTree = NULL;
-  // parse the query string into a tree structure
-  queryTree = ParseQuery(queryArray, data->defaultBoolCombine, 
-			 data->defaultStemMethod, data->maxNumeric);
-  if (queryTree == NULL) {
-    // invalid syntax
-    j_env->CallVoidMethod(result_ptr, MID_setSyntaxError, true);
-    cerr << "MGPPWrapperImpl: invalid query syntax!!\n";
-    return; 
-  }
-  // print the query
-  PrintNode (cout, queryTree);
-  // finally, do the query
-  MGQuery(*(data->indexData), *(data->queryInfo), queryTree, queryResult, data->level);
-
-  delete queryTree;
-
-  // convert queryResult to the java side version
-  // use levels rather than docs of ExtQueryResult
-  // CallVoidMethod(obj, method id, args to method)
-  for (int i=0; i<queryResult.levels.size(); i++) {
-    jlong doc = queryResult.levels[i];
-    jfloat rank = queryResult.ranks[i];
-    j_env->CallVoidMethod(result_ptr, MID_addDoc, doc, rank);
-    exc = j_env->ExceptionOccurred();
-    if (exc) {
-      j_env->ExceptionDescribe();
-      return;
-    }
-    
-  }
-
-  // actual num of docs
-  jlong total = queryResult.actualNumDocs;
-  j_env->CallVoidMethod(result_ptr, MID_setTotalDocs, total);
-  exc = j_env->ExceptionOccurred();
-  if (exc) {
-    j_env->ExceptionDescribe();
-    return;
-  }
-
-  // the terms
-  for (int j=0; j<queryResult.termFreqs.size(); j++) {
-    
-    TermFreqData tf = queryResult.termFreqs[j];
-    jstring term = j_env->NewStringUTF(GetCStr(tf.term));
-    jstring tag = j_env->NewStringUTF(GetCStr(tf.tag));
-    jint stem = tf.stemMethod;
-    jlong match = tf.matchDocs;
-    jlong freq = tf.termFreq;
-    
-    jobjectArray equivs=NULL;
-    jstring empty = j_env->NewStringUTF(""); // the initial object to fill the array
-    jint num_equivs = tf.equivTerms.size();
-    equivs = j_env->NewObjectArray(num_equivs, CID_String, empty);
-    if (equivs==NULL) {
-      cerr<<"couldn't create object array"<<endl;
-      
-    } else {
-      for (int k=0; k<num_equivs;k++) {
-	jstring equiv = j_env->NewStringUTF(GetCStr(tf.equivTerms[k]));
-	j_env->SetObjectArrayElement(equivs, k, equiv);
-      }
-      
-      
-      j_env->CallVoidMethod(result_ptr, MID_addTerm, term, tag, stem, match, freq, equivs);
-      exc = j_env->ExceptionOccurred();
-      if (exc) {
-	j_env->ExceptionDescribe();
-	return;
-      }
-    }
-  }
-
-
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setStem (JNIEnv *j_env, 
-					      jobject j_obj, 
-					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  if (j_on) {
-    data->defaultStemMethod |= 2;
-  } else {
-    data->defaultStemMethod &= 0xd;
-  }
-
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setAccentFold (JNIEnv *j_env, 
-					      jobject j_obj, 
-					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  if (j_on) {
-    data->defaultStemMethod |= 4;
-  } else {
-    data->defaultStemMethod &= 0xb;
-  }
-}
-
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setCase (JNIEnv *j_env, 
-					      jobject j_obj, 
-					      jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-
-  if (j_on) {
-    data->defaultStemMethod |= 1;
-  } else {
-    data->defaultStemMethod &= 0xe;
-  }
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setMaxDocs (JNIEnv *j_env, 
-						 jobject j_obj, 
-						 jint j_max) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  data->queryInfo->maxDocs=j_max;
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setMaxNumeric (JNIEnv *j_env, 
-						 jobject j_obj, 
-						 jint j_max) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  data->maxNumeric=j_max;
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setSortByRank (JNIEnv *j_env, 
-						    jobject j_obj, 
-						    jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  
-  data->queryInfo->sortByRank=j_on;
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setReturnTerms(JNIEnv *j_env, 
-						    jobject j_obj, 
-						    jboolean j_on) {
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  data->queryInfo->needTermFreqs = j_on;
- 
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setQueryLevel(JNIEnv *j_env, 
-						   jobject j_obj, 
-						   jstring j_level){
-  
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-
-  const char * level = j_env->GetStringUTFChars(j_level, NULL);
-  if (level==NULL) {
-    return; // exception already thrown
-  }
-  
-  data->queryInfo->docLevel.clear();
-  SetCStr(data->queryInfo->docLevel, level);
-  
-  // release the java stuff
-  j_env->ReleaseStringUTFChars(j_level, level);
- 
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setReturnLevel(JNIEnv *j_env, 
-						    jobject j_obj, 
-						    jstring j_level){
-
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-
-  const char * level = j_env->GetStringUTFChars(j_level, NULL);
-  if (level==NULL) {
-    return; // exception already thrown
-  }
-  
-  data->level.clear();
-  SetCStr(data->level, level);
-  
-  // release the java stuff
-  j_env->ReleaseStringUTFChars(j_level, level);
-    
-
-}
-
-JNIEXPORT void JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_setMatchMode (JNIEnv *j_env,
-						   jobject j_obj,
-						   jint j_mode){
-
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  data->defaultBoolCombine=j_mode;
-
-}
-
-JNIEXPORT jstring JNICALL 
-Java_org_greenstone_mgpp_MGPPWrapper_getQueryParams (JNIEnv *j_env,
-						     jobject j_obj){
-
-  MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data);
-  
-  // print the data to a stringstream, then convert to char*, then to 
-  //jstring
-
-  stringstream output;
-  output << "Query params:"<<endl
-    // need to change this to use platform specific separator for niceness
-	 << "index\t\t"<<data->indexData->basePath<<"/"<<data->indexData->filename<<endl
-	 <<"search level\t"<<GetCStr(data->queryInfo->docLevel)<<endl
-	 <<"result level\t"<<GetCStr(data->level)<<endl
-	 <<"casefold\t"<<(data->defaultStemMethod&1)<<endl
-	 <<"stem\t\t"<<(data->defaultStemMethod&2)<<endl
-	 <<"order by rank\t"<<data->queryInfo->sortByRank<<endl
-	 <<"query type\t"<<(data->defaultBoolCombine==1?"all":"some")<<endl
-         <<"max docs\t"<<data->queryInfo->maxDocs<<endl<<ends;
-
-  const char *result = output.str().c_str();
-  jstring j_result = j_env->NewStringUTF(result);
-  delete (char *)result;
-  return j_result;
-}
Index: dexers/trunk/mgpp/jni/MGPPWrapperImpl.h
===================================================================
--- /indexers/trunk/mgpp/jni/MGPPWrapperImpl.h	(revision 16348)
+++ 	(revision )
@@ -1,16 +1,0 @@
-#include "MGQuery.h"
-
-// the global stuff we need to do a query
-class MGPPWrapperData {
- public:
-  IndexData * indexData;
-  QueryInfo * queryInfo;
-  int defaultStemMethod;
-  int defaultBoolCombine;
-  int maxNumeric;
-  UCArray level; // the return level
-
-  MGPPWrapperData();
-  ~MGPPWrapperData();
-
-};
