Changeset 13567


Ignore:
Timestamp:
2007-01-11T14:27:38+13:00 (15 years ago)
Author:
shaoqun
Message:

the content of a document will not be retrieved if the default index is absent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java

    r13270 r13567  
    4141    // Elements used in the config file that are specific to this class
    4242    private static final String DEFAULT_INDEX_ELEM = "defaultIndex";
     43    private static final String INDEX_LIST_ELEM = "indexList";
     44    private static final String INDEX_ELEM = "index";
    4345
    4446    private MGWrapper mg_src = null;
     
    4648    private String mg_textdir = null;
    4749    private String default_index = null;
     50    private boolean has_default_index = false;
    4851   
    4952    public GS2MGRetrieve() {
     
    7275    }
    7376    if (this.default_index == null || this.default_index.equals("")) {
    74         logger.error("default index not specified!");
    75         return false;
     77             logger.error("default index is not specified, the content of a document will not be retrieved");
     78              has_default_index = false;
     79          return true;
     80        //}
    7681    }
    7782    logger.debug("Default index: " + this.default_index);
    78 
     83       
    7984    // The location of the MG index and text files
    8085    mg_basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + File.separatorChar;  // Needed by MG
     
    8388    String indexpath = GSFile.collectionIndexPath(this.index_stem, this.default_index);
    8489    this.mg_src.setIndex(indexpath);
    85 
     90    has_default_index = true;
    8691    return true;
    8792    }
     
    100105    Element content_node = this.doc.createElement(GSXML.NODE_CONTENT_ELEM);
    101106   
    102     String doc_content = this.mg_src.getDocument(this.mg_basedir,
    103                              this.mg_textdir, doc_num);
    104    
     107         
     108    String doc_content = null;
     109
     110    if (has_default_index ){
     111            doc_content =  this.mg_src.getDocument(this.mg_basedir,
     112                         this.mg_textdir, doc_num);
     113    }
     114 
    105115    if (doc_content!=null) {
    106116        // remove any ctrl-c or ctrl-b
     
    111121    } else {
    112122        logger.error("the doc content was null, not getting that section\n");
    113         doc_content = "couldn't retrieve content for this section\n";
     123        doc_content = "couldn't retrieve content for this section, please check the log file for more detail\n";
    114124    }
    115125    Text t = this.doc.createTextNode(doc_content);
Note: See TracChangeset for help on using the changeset viewer.