Changeset 4215


Ignore:
Timestamp:
2003-05-01T12:05:32+12:00 (21 years ago)
Author:
kjdon
Message:

fixed up some left over stuff from changing the mgpp basepath stuff (to make it work on windows), also now checks teh query result for syntax error

Location:
trunk
Files:
2 edited

Legend:

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

    r3446 r4215  
    44import java.io.BufferedReader;
    55import java.io.InputStreamReader;
    6 
     6import java.io.File;
    77/** Queryer - java port of c++ Queryer
    88 * - uses MGPPWrapper to access mgpp
     
    4949    String index_path = args[1];
    5050
     51    text_path = base_dir + File.separatorChar+text_path;
     52    index_path = base_dir  + File.separatorChar+ index_path;
     53   
    5154    // the jni class to access mgpp stuff
    5255    MGPPWrapper wrapper = new MGPPWrapper();
    53     wrapper.loadIndexData(base_dir, index_path);
     56    wrapper.loadIndexData(index_path);
    5457   
    5558    // the return level
     
    9194            case 'p': // print doc
    9295            int docnum = Integer.parseInt(data);
    93             String doc = wrapper.getDocument(base_dir, text_path,
     96            String doc = wrapper.getDocument(text_path,
    9497                             level, docnum);
    9598            System.out.println(doc);
     
    160163            wrapper.runQuery(command);
    161164            MGPPQueryResult res = wrapper.getQueryResult();
    162             if (shortOutput) {
    163               System.out.println(res.toShortString());
     165            if (res.hasSyntaxError()) {
     166              System.out.println("invalid syntax error\n");
    164167            } else {
    165               System.out.println(res.toString());
     168              if (shortOutput) {
     169            System.out.println(res.toShortString());
     170              } else {
     171            System.out.println(res.toString());
     172              }
    166173            }
    167174        }
  • trunk/mgpp/java/org/greenstone/mgpp/Queryer.java

    r3446 r4215  
    44import java.io.BufferedReader;
    55import java.io.InputStreamReader;
    6 
     6import java.io.File;
    77/** Queryer - java port of c++ Queryer
    88 * - uses MGPPWrapper to access mgpp
     
    4949    String index_path = args[1];
    5050
     51    text_path = base_dir + File.separatorChar+text_path;
     52    index_path = base_dir  + File.separatorChar+ index_path;
     53   
    5154    // the jni class to access mgpp stuff
    5255    MGPPWrapper wrapper = new MGPPWrapper();
    53     wrapper.loadIndexData(base_dir, index_path);
     56    wrapper.loadIndexData(index_path);
    5457   
    5558    // the return level
     
    9194            case 'p': // print doc
    9295            int docnum = Integer.parseInt(data);
    93             String doc = wrapper.getDocument(base_dir, text_path,
     96            String doc = wrapper.getDocument(text_path,
    9497                             level, docnum);
    9598            System.out.println(doc);
     
    160163            wrapper.runQuery(command);
    161164            MGPPQueryResult res = wrapper.getQueryResult();
    162             if (shortOutput) {
    163               System.out.println(res.toShortString());
     165            if (res.hasSyntaxError()) {
     166              System.out.println("invalid syntax error\n");
    164167            } else {
    165               System.out.println(res.toString());
     168              if (shortOutput) {
     169            System.out.println(res.toShortString());
     170              } else {
     171            System.out.println(res.toString());
     172              }
    166173            }
    167174        }
Note: See TracChangeset for help on using the changeset viewer.