Changeset 16349

Show
Ignore:
Timestamp:
11.07.2008 10:03:44 (11 years ago)
Author:
kjdon
Message:

deleted the old MGPPWrapper stuff (java and jni sides) and tidied up the new MGPPSearchWrapper and MGPPRetrieveWrapper which replace it. Modified Queryer to use the new classes

Location:
indexers/trunk/mgpp
Files:
1 added
3 removed
5 modified

Legend:

Unmodified
Added
Removed
  • indexers/trunk/mgpp/java/org/greenstone/mgpp/MGPPRetrieveWrapper.java

    r14487 r16349  
    11/* 
    22 *    MGPPRetrieveWrapper.java 
    3  *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org 
     3 *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org 
    44 * 
    55 *    This program is free software; you can redistribute it and/or modify 
     
    1919package org.greenstone.mgpp; 
    2020 
    21 import java.util.Vector; 
    2221 
    23 /** java wrapper class for access to mgpp in C++ 
     22 
     23/** java wrapper class for access to mgpp document retrieval mgpp in C++ 
    2424 * 
    25  * the native side implemented in MGPPWrapperImpl.cpp 
    26  * uses MGPPQueryResult to hold the result of a query. the  
    27  * result of a getDocument is a String 
    28  * uses the jni 
     25 * the native side is implemented in MGPPSearchWrapperImpl.cpp 
     26 * the result of getDocument is a String 
     27 * uses jni 
    2928 * 
    30  *@see MGPPQueryResult 
    3129 */ 
    3230public class MGPPRetrieveWrapper { 
    3331   
    34     /** the query result 
    35      * will be filled in by runQuery 
    36      */ 
    37     protected MGPPQueryResult mgpp_query_result_=null;  
    38     /** pointer to c++ MGPPWrapperData class - cached indexData and queryInfo 
    39      */ 
    40     protected long mgpp_data_ptr_=0; 
    41  
    4232    static { 
    4333    System.loadLibrary("mgppretrievejni"); 
    44     initIDs(); 
    4534    } 
    4635     
    4736    public MGPPRetrieveWrapper() { 
    48     mgpp_query_result_ = new MGPPQueryResult(); 
    49     initCppSide(); 
    5037    } 
    51  
    52     /** initialises field and method IDs for java side to enable access on 
    53     C++ side */ 
    54     //these two init methods and the load and unload methods are shared by search and retrieve 
    55     private static native void initIDs(); 
    56  
    57     /** initialises the mgpp_data_ptr_ */ 
    58     private native boolean initCppSide(); 
    5938 
    6039    /** returns a document: number docnum at level level  
     
    6746                     long docnum ); 
    6847 
    69     /** the public method - converts between utf-8 and unicode 
    70      */ 
    71     // public String getDocument(String text_path, 
    72     //            String level, 
    73     //            long docnum ) { 
    74  
    75     //String utf8_doc = getUtF8Document(base_dir, text_path, level, docnum); 
    76      
    77     /** load up the data structure for index  
    78      * - maintains state between requests as can be slow   
    79      * index_path should provide 
    80      * the absolute location of the mgpp index files eg ..../index/tt/demo  
    81      */ 
    82     public native boolean loadIndexData(String index_path); 
    83     /** unloads the data */ 
    84     public native boolean unloadIndexData(); 
    85  
    86     // query param methods 
    87 // 
    88 //    /** if on=true, sets default stemming on  - its off by default*/ 
    89 //    public native void setStem(boolean on); 
    90 //     
    91 //    /** if on=true, sets default accentfolding on  - its off by default*/ 
    92 //    public native void setAccentFold(boolean on); 
    93 // 
    94 //   /** if on=true, sets default casefolding on - its off by default */ 
    95 //   public native void setCase(boolean on); 
    96 //    /** default is 50 */ 
    97 //    public native void setMaxDocs(int num); 
    98 //    /** if on=true, sorts by rank, otherwise returns in build order -  
    99 //  default is on */ 
    100 //    public native void setSortByRank(boolean on); 
    101 //    /** if on=true, a query returns term freq info - default is on */ 
    102 //    public native void setReturnTerms(boolean on); 
    103 //    /** sets the granularity of the  query  - default 'Document' */ 
    104 //    public native void setQueryLevel(String level); 
    105 //    /** sets the granularity of the result - default 'Document' */ 
    106 //    public native void setReturnLevel(String level); 
    107 //    /** sets the default boolean operator - AND(=1)/OR(=0) */ 
    108 //    public native void setMatchMode(int mode); 
    109 // 
    110 //    /** sets maxnumeric */ 
    111 //    public native void setMaxNumeric(int maxnumeric); 
    112 //    /** returns a string with all the current query param settings */ 
    113 //    public native String getQueryParams(); 
    114 // 
    115 //    /** actually carry out the query. Use the set methods to set any query 
    116 //  params  
    117 //    * writes the result to query_result 
    118 //    */ 
    119 //    public native void runQuery(String query_string);  
    120 // 
    121 //    /** get the result out of the wrapper */ 
    122 //    public MGPPQueryResult getQueryResult() { 
    123 //  return mgpp_query_result_; 
    124 //    } 
    125 //     
    12648} 
  • indexers/trunk/mgpp/java/org/greenstone/mgpp/Makefile.in

    r15559 r16349  
    4848compile: setup 
    4949    $(JAVAC) -d $(JAVACLASSDIR) -sourcepath $(JAVASRCDIR) $(JAVACOPTIONS) *.java 
    50     $(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPWrapper 
     50#   $(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPWrapper 
    5151    $(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPPassesWrapper 
    52  
     52    $(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPSearchWrapper 
     53    $(JAVAH) -classpath $(JAVACLASSPATH) -d $(MGPPHOME)/jni org.greenstone.mgpp.MGPPRetrieveWrapper  
    5354    $(JAR) cf $(MGPPHOME)/mgpp.jar -C $(JAVACLASSDIR) org 
    5455 
    5556clean: 
    56     rm -rf $(JAVACLASSDIR) $(MGPPHOME)/mgpp.jar $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPWrapper.h $(MGPPHOME)/jni/org_greenstone_mgpp_MGPPPassesWrapper.h 
     57    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 
    5758 
    5859install: 
  • indexers/trunk/mgpp/java/org/greenstone/mgpp/Queryer.java

    r16348 r16349  
    66import java.io.File; 
    77/** Queryer - java port of c++ Queryer  
    8  * - uses MGPPWrapper to access mgpp 
     8 * - uses MGPPSearchWrapper and MGPPRetrieveWrapper to access mgpp 
    99 * only has get document and search - full text browse not implemented 
    1010 * 
    1111 * run as: 
    1212 * java org.greenstone.mgpp.Queryer <basedir> <indexdir> <textdir> 
    13  *@see MGPPWrapper 
     13 *@see MGPPSearchWrapper 
     14 *@see MGPPRetrieveWrapper 
    1415 */ 
    1516public class Queryer { 
     
    5253    index_path = base_dir  + File.separatorChar+ index_path; 
    5354     
    54     // the jni class to access mgpp stuff 
    55     MGPPWrapper wrapper = new MGPPWrapper(); 
    56     wrapper.loadIndexData(index_path); 
    57      
     55    // the jni classes to access mgpp stuff 
     56    MGPPSearchWrapper searcher = new MGPPSearchWrapper(); 
     57    MGPPRetrieveWrapper retriever = new MGPPRetrieveWrapper(); 
     58    searcher.loadIndexData(index_path); 
     59     
    5860    // the return level 
    5961    String level = "Section"; 
     
    8385      switch (x) { 
    8486      case 'q': // clean up and exit 
    85         wrapper.unloadIndexData(); 
     87        searcher.unloadIndexData(); 
    8688        return;   
    8789      case 'h': // print help message 
     
    8991        break; 
    9092      case 'd': // print query param settings 
    91         String info = wrapper.getQueryParams(); 
     93        String info = searcher.getQueryParams(); 
    9294        System.out.println(info); 
    9395        break; 
    9496      case 'p': // print doc 
    9597        int docnum = Integer.parseInt(data); 
    96         String doc = wrapper.getDocument(text_path,  
     98        String doc = retriever.getDocument(text_path,  
    9799                         level, docnum); 
    98100        System.out.println(doc); 
     
    100102      case 'm': //match docs 
    101103        int match = Integer.parseInt(data); 
    102         wrapper.setMaxDocs(match); 
     104        searcher.setMaxDocs(match); 
    103105        break; 
    104106      case 's': // set stem on/off 
    105107        int stem = Integer.parseInt(data); 
    106108        if (stem==0 ){ 
    107           wrapper.setStem(false); 
     109          searcher.setStem(false); 
    108110        } else if(stem==1) { 
    109           wrapper.setStem(true); 
     111          searcher.setStem(true); 
    110112        } else { 
    111113          System.err.println("Error: stem should be 0 or 1"); 
     
    115117        int casef = Integer.parseInt(data); 
    116118        if (casef==0) { 
    117           wrapper.setCase(false); 
     119          searcher.setCase(false); 
    118120        } else if (casef==1) { 
    119           wrapper.setCase(true); 
     121          searcher.setCase(true); 
    120122        } else { 
    121123          System.err.println("Error: case should be 0 or 1"); 
     
    123125        break; 
    124126      case 'i': // set search level 
    125         wrapper.setQueryLevel(data); 
     127        searcher.setQueryLevel(data); 
    126128        break; 
    127129      case 'l': // set result level 
    128         wrapper.setReturnLevel(data); 
     130        searcher.setReturnLevel(data); 
    129131        level = data; 
    130132        break;  
     
    132134        int rank = Integer.parseInt(data); 
    133135        if (rank==0) { 
    134           wrapper.setSortByRank(false); 
     136          searcher.setSortByRank(false); 
    135137        } else if (rank==1) { 
    136           wrapper.setSortByRank(true); 
     138          searcher.setSortByRank(true); 
    137139        } else { 
    138140          System.err.println("Error: rank should be 0 or 1"); 
     
    142144        int type = Integer.parseInt(data); 
    143145        if (type==0 || type==1) { 
    144           wrapper.setMatchMode(type); 
     146          searcher.setMatchMode(type); 
    145147        } else { 
    146148          System.err.println("Error: type should be 0 (some) or 1 (all)"); 
     
    161163    else { 
    162164      // a query 
    163       wrapper.runQuery(command); 
    164       MGPPQueryResult res = wrapper.getQueryResult(); 
     165      searcher.runQuery(command); 
     166      MGPPQueryResult res = searcher.getQueryResult(); 
    165167      if (res.hasSyntaxError()) { 
    166168        System.out.println("invalid syntax error\n"); 
  • indexers/trunk/mgpp/jni/MGPPRetrieveWrapperImpl.cpp

    r14910 r16349  
    11/* 
    22 *    MGPPRetrieveWrapperImpl.c 
    3  *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org 
     3 *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org 
    44 * 
    55 *    This program is free software; you can redistribute it and/or modify 
     
    1717 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
    1818 */  
     19 
    1920#ifdef __WIN32__ 
    2021#include <win32cfg.h> 
    21 #include <strstream> 
    22 #include <sstream> 
    23 #else 
    24 #ifdef __APPLE__ 
    25 #include <strstream> 
    26 #include <sstream> 
    27 #else 
    28 #include <sstream> 
    29 #endif 
    3022#endif 
    3123 
    3224#include <jni.h> 
    3325#include "org_greenstone_mgpp_MGPPRetrieveWrapper.h" 
    34 #include "MGPPWrapperImpl.h" 
    3526#include "TextGet.h" 
    36 #include "GSDLQueryParser.h" 
    37 #include "MGQuery.h" 
    38    
    39 MGPPWrapperData::MGPPWrapperData() { 
    40   indexData = new IndexData(); 
    41   queryInfo = new QueryInfo(); 
    4227 
    43   if (queryInfo==NULL) { 
    44     cerr<<"couldn't allocate new query info\n"; 
    45     if (indexData!=NULL) { 
    46       delete indexData; 
    47     } 
    48   } 
    49  
    50   // set all the default params 
    51   //SetCStr(queryInfo->docLevel, "Document"); // the level to search at 
    52   queryInfo->maxDocs = 50; 
    53   queryInfo->sortByRank = true; 
    54   queryInfo->exactWeights = false; 
    55   queryInfo->needRankInfo = true; 
    56   queryInfo->needTermFreqs = true; 
    57  
    58   UCArrayClear(level); 
    59   SetCStr(level, "Document"); // the level to return docs at 
    60   defaultStemMethod=0; 
    61   defaultBoolCombine=0; 
    62   maxNumeric = 4; 
    63 } 
    64  
    65 MGPPWrapperData::~MGPPWrapperData() {  
    66   if (indexData !=NULL) { 
    67     delete indexData; 
    68   } 
    69   if (queryInfo !=NULL) { 
    70     delete queryInfo; 
    71   } 
    72 } 
    73  
    74 // ******************************************** 
    75 // initialisation stuff 
    76 // ******************************************** 
    77  
    78 // cached ids for java stuff  
    79 jfieldID FID_mgpp_data = NULL; // MGPPWrapperData 
    80 jfieldID FID_query_result = NULL; // MGPPQueryResult 
    81 jmethodID MID_addDoc=NULL; // MGPPQueryResult.addDoc() 
    82 jmethodID MID_addTerm=NULL; // MGPPQueryResult.addTerm() 
    83 jmethodID MID_setTotalDocs=NULL; // MGPPQueryResult.setTotalDocs() 
    84 jmethodID MID_clearResult=NULL; //MGPPQueryResult.clear() 
    85 jmethodID MID_setSyntaxError=NULL; // MGPPQueryResult.setSyntaxError() 
    86 jclass CID_String=NULL; // class ID of String 
    87  
    88 /* to access objects and methods on java side, need their field/method ids -  
    89  this initialises them at the start to avoid recalculating them each time they 
    90  are needed  
    91 Note: the descriptors need to be exactly right, otherwise you get an error  
    92 saying "no such field" but no reference to the fact that it has the right  
    93 name but the wrong type. 
    94 Note: apparently the jclass is a local ref and should only work  
    95 in the method that created it. It seems to work ok, but I'll make it 
    96  global cos the book said I should, and it may avoid future hassles. 
    97 */ 
    98 JNIEXPORT void JNICALL  
    99 Java_org_greenstone_mgpp_MGPPRetrieveWrapper_initIDs (JNIEnv *j_env, jclass j_cls) { 
    100    
    101   FID_mgpp_data = j_env->GetFieldID(j_cls, "mgpp_data_ptr_", "J"); //a long-"J" 
    102   if (FID_mgpp_data==NULL) { 
    103       cerr <<"MGPP JNI: field mgpp_data_ptr_ not found"<<endl; 
    104   }  
    105  
    106   FID_query_result = j_env->GetFieldID(j_cls, "mgpp_query_result_", "Lorg/greenstone/mgpp/MGPPQueryResult;"); // an object -"L<class name>;" 
    107   if (FID_query_result==NULL) { 
    108       cerr <<"MGPP JNI: field mgpp_query_result_ not found"<<endl; 
    109   } 
    110   // the methods we want to use 
    111  
    112   // addDoc(long doc, float rank) 
    113   jclass JC_MGPPQueryResult = j_env->FindClass("org/greenstone/mgpp/MGPPQueryResult"); 
    114   MID_addDoc = j_env->GetMethodID(JC_MGPPQueryResult, "addDoc", "(JF)V"); 
    115   if (MID_addDoc==NULL) { 
    116       cerr <<"MGPP JNI: addDoc method not found"<<endl; 
    117   } 
    118   // addTerm(String term, String tag, int stem_method, long match_docs,  
    119   // long term_freq, String[] equiv_terms) 
    120   MID_addTerm = j_env->GetMethodID(JC_MGPPQueryResult, "addTerm", "(Ljava/lang/String;Ljava/lang/String;IJJ[Ljava/lang/String;)V"); 
    121   if (MID_addTerm==NULL) { 
    122       cerr <<"MGPP JNI: method addTerm not found"<<endl; 
    123   } 
    124    
    125   // setTotalDocs(long) 
    126   MID_setTotalDocs = j_env->GetMethodID(JC_MGPPQueryResult, "setTotalDocs", "(J)V"); 
    127   if (MID_setTotalDocs==NULL) { 
    128       cerr <<"MGPP JNI: method setTotalDocs not found"<<endl; 
    129   } 
    130    
    131   MID_clearResult = j_env->GetMethodID(JC_MGPPQueryResult, "clear", "()V"); 
    132   if (MID_clearResult==NULL) { 
    133       cerr <<"MGPP JNI: method clear not found"<<endl; 
    134   } 
    135   MID_setSyntaxError = j_env->GetMethodID(JC_MGPPQueryResult, "setSyntaxError", "(Z)V"); 
    136   if (MID_clearResult==NULL) { 
    137       cerr <<"MGPP JNI: method setSyntaxError not found"<<endl; 
    138   } 
    139  
    140   // get the class for String to use in NewObjectArray in runQuery() 
    141   // FindClass returns a local reference - have to convert it to a global one 
    142   jclass local_CID_String = j_env->FindClass("java/lang/String"); 
    143   if (local_CID_String==NULL) { 
    144     cerr <<"MGPP JNI: java String class not found"<<endl; 
    145   } else {  
    146     /* create a global ref */ 
    147     CID_String = (jclass)j_env->NewGlobalRef(local_CID_String); 
    148     /* The local reference is no longer useful */ 
    149     j_env->DeleteLocalRef(local_CID_String); 
    150   
    151     /* Is the global reference created successfully? */ 
    152     if (CID_String == NULL) { 
    153       return; /* out of memory exception thrown */ 
    154     } 
    155   } 
    156    
    157 } 
    158  
    159 /* the java side MGPPWrapper has a pointer to a C++ object - MGPPWrapperData 
    160    initialise this and set the pointer  
    161 */ 
    162 JNIEXPORT jboolean JNICALL  
    163 Java_org_greenstone_mgpp_MGPPRetrieveWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){ 
    164  
    165   MGPPWrapperData * data = new MGPPWrapperData(); 
    166   j_env->SetIntField(j_obj, FID_mgpp_data, (long)data); 
    167  
    168   return true; 
    169  
    170 } 
    17128 
    17229//**************************************************** 
     
    21673  td.UnloadData(); 
    21774   
    218   char * doc = GetCStr(docText); // do I need to free this char *?? 
     75  char * doc = GetCStr(docText);  
    21976  jstring result = j_env->NewStringUTF(doc); 
    22077  // release any gets 
     
    22885  
    22986} 
    230  
    231 //****************************************** 
    232 // do a query 
    233 // **************************************** 
    234  
    235 /* load the IndexData - cached for querying 
    236  */ 
    237 JNIEXPORT jboolean JNICALL  
    238 Java_org_greenstone_mgpp_MGPPRetrieveWrapper_loadIndexData (JNIEnv *j_env, jobject j_obj,  jstring j_index_name) { 
    239  
    240   jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data); 
    241   MGPPWrapperData * data = (MGPPWrapperData *)data_ptr; 
    242  
    243 #ifdef __WIN32__ 
    244   const char* base_dir = ""; 
    245 #else 
    246   const char* base_dir = "/"; 
    247 #endif 
    248  
    249   const char * index_name = j_env->GetStringUTFChars( j_index_name, NULL); 
    250   if (index_name==NULL) { 
    251     return false; 
    252   } 
    253    
    254   jboolean j_result=false; 
    255    
    256   // why doesn't this complain about const?? 
    257   if (data->indexData->LoadData(base_dir, index_name)) { 
    258     j_result=true; 
    259   } 
    260    
    261   // release any gets 
    262   j_env->ReleaseStringUTFChars(j_index_name, index_name); 
    263    
    264   return j_result; 
    265 } 
    266  
    267 /* unload the data  
    268  */ 
    269 JNIEXPORT jboolean JNICALL  
    270 Java_org_greenstone_mgpp_MGPPRetrieveWrapper_unloadIndexData (JNIEnv *j_env, jobject j_obj) { 
    271  
    272   jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data); 
    273   MGPPWrapperData * data = (MGPPWrapperData *)data_ptr; 
    274  
    275   data->indexData->UnloadData(); 
    276   return true; 
    277  
    278 } 
  • indexers/trunk/mgpp/jni/MGPPSearchWrapperImpl.cpp

    r14910 r16349  
    11/* 
    2  *    MGPPSearchWrapperImpl.c 
    3  *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org 
     2 *    MGPPSearchWrapperImpl.cpp 
     3 *    Copyright (C) 2007 New Zealand Digital Library, http://www.nzdl.org 
    44 * 
    55 *    This program is free software; you can redistribute it and/or modify 
     
    3232#include <jni.h> 
    3333#include "org_greenstone_mgpp_MGPPSearchWrapper.h" 
    34 #include "MGPPWrapperImpl.h" 
    35 #include "TextGet.h" 
     34#include "MGPPSearchWrapperImpl.h" 
    3635#include "GSDLQueryParser.h" 
    3736#include "MGQuery.h" 
    3837   
    39 MGPPWrapperData::MGPPWrapperData() { 
     38MGPPSearchData::MGPPSearchData() { 
    4039  indexData = new IndexData(); 
    4140  queryInfo = new QueryInfo(); 
     
    6362} 
    6463 
    65 MGPPWrapperData::~MGPPWrapperData() {  
     64MGPPSearchData::~MGPPSearchData() {  
    6665  if (indexData !=NULL) { 
    6766    delete indexData; 
     
    7776 
    7877// cached ids for java stuff  
    79 jfieldID FID_mgpp_data = NULL; // MGPPWrapperData 
     78jfieldID FID_mgpp_data = NULL; // MGPPSearchData 
    8079jfieldID FID_query_result = NULL; // MGPPQueryResult 
    8180jmethodID MID_addDoc=NULL; // MGPPQueryResult.addDoc() 
     
    157156} 
    158157 
    159 /* the java side MGPPWrapper has a pointer to a C++ object - MGPPWrapperData 
     158/* the java side MGPPSearchWrapper has a pointer to a C++ object - MGPPSearchData 
    160159   initialise this and set the pointer  
    161160*/ 
     
    163162Java_org_greenstone_mgpp_MGPPSearchWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){ 
    164163 
    165   MGPPWrapperData * data = new MGPPWrapperData(); 
     164  MGPPSearchData * data = new MGPPSearchData(); 
    166165  j_env->SetIntField(j_obj, FID_mgpp_data, (long)data); 
    167166 
     
    180179 
    181180  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data); 
    182   MGPPWrapperData * data = (MGPPWrapperData *)data_ptr; 
     181  MGPPSearchData * data = (MGPPSearchData *)data_ptr; 
    183182 
    184183#ifdef __WIN32__ 
     
    212211 
    213212  jint data_ptr = j_env->GetIntField(j_obj, FID_mgpp_data); 
    214   MGPPWrapperData * data = (MGPPWrapperData *)data_ptr; 
     213  MGPPSearchData * data = (MGPPSearchData *)data_ptr; 
    215214 
    216215  data->indexData->UnloadData(); 
     
    235234   
    236235  // the query data 
    237   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     236  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    238237   
    239238  // the result to write to 
     
    246245  // clear the result 
    247246  j_env->CallVoidMethod(result_ptr, MID_clearResult); 
    248   exc = j_env->ExceptionOccurred(); // this catches teh exception I think - it 
     247  exc = j_env->ExceptionOccurred(); // this catches the exception I think - it 
    249248  //wont be thrown any further 
    250249  if (exc) { 
     
    262261    // invalid syntax 
    263262    j_env->CallVoidMethod(result_ptr, MID_setSyntaxError, true); 
    264     cerr << "MGPPWrapperImpl: invalid query syntax!!\n"; 
     263    cerr << "MGPPSearchWrapperImpl: invalid query syntax!!\n"; 
    265264    return;  
    266265  } 
     
    336335                          jobject j_obj,  
    337336                          jboolean j_on) { 
    338   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     337  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    339338  if (j_on) { 
    340339    data->defaultStemMethod |= 2; 
     
    349348                          jobject j_obj,  
    350349                          jboolean j_on) { 
    351   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     350  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    352351  if (j_on) { 
    353352    data->defaultStemMethod |= 4; 
     
    362361                          jobject j_obj,  
    363362                          jboolean j_on) { 
    364   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     363  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    365364 
    366365  if (j_on) { 
     
    375374                         jobject j_obj,  
    376375                         jint j_max) { 
    377   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     376  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    378377  data->queryInfo->maxDocs=j_max; 
    379378} 
     
    383382                         jobject j_obj,  
    384383                         jint j_max) { 
    385   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     384  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    386385  data->maxNumeric=j_max; 
    387386} 
     
    391390                            jobject j_obj,  
    392391                            jboolean j_on) { 
    393   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     392  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    394393   
    395394  data->queryInfo->sortByRank=j_on; 
     
    400399                            jobject j_obj,  
    401400                            jboolean j_on) { 
    402   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     401  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    403402  data->queryInfo->needTermFreqs = j_on; 
    404403  
     
    410409                           jstring j_level){ 
    411410   
    412   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     411  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    413412 
    414413  const char * level = j_env->GetStringUTFChars(j_level, NULL); 
     
    430429                            jstring j_level){ 
    431430 
    432   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     431  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    433432 
    434433  const char * level = j_env->GetStringUTFChars(j_level, NULL); 
     
    451450                           jint j_mode){ 
    452451 
    453   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     452  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    454453  data->defaultBoolCombine=j_mode; 
    455454 
     
    460459                             jobject j_obj){ 
    461460 
    462   MGPPWrapperData * data = (MGPPWrapperData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
     461  MGPPSearchData * data = (MGPPSearchData *)j_env->GetIntField(j_obj, FID_mgpp_data); 
    463462   
    464463  // print the data to a stringstream, then convert to char*, then to