Ignore:
Timestamp:
2003-03-11T16:58:35+13:00 (21 years ago)
Author:
kjdon
Message:

a wide variety of changes, next I will go through and make sure the code is tidy, nad tidy up teh xml a bit, but I wanted to check in all this first.

File:
1 edited

Legend:

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

    r3822 r3851  
    3030/**
    3131 *
    32  * @author <a href="mailto:[email protected]">Katherine Don</a>
     32 * @author <a href="mailto:[email protected]">Michael Dewsnip</a>
    3333 * @version $Revision$
    3434 */
     
    4242
    4343    // Parameters used
     44    protected static final String INDEX_PARAM = "index";
    4445    protected static final String CASE_PARAM = "case";
    4546    protected static final String STEM_PARAM = "stem";
     
    5859    protected static final String FREQ_ATT = "freq";
    5960
     61    // Elements used in the config file that are specific to this class
     62    protected static final String DEFAULT_INDEX_ELEM = "defaultIndex";
     63    protected static final String DEFAULT_LEVEL_ELEM = "defaultLevel";
     64    protected static final String INDEX_ELEM = "index";
     65    protected static final String LEVEL_ELEM = "level";
     66
    6067    protected GDBMWrapper gdbm_src_ = null;
    6168
    6269    protected Element config_info_ = null;
     70
     71    /** the default index */
     72    protected String default_index_ = null;
    6373
    6474
     
    7585    System.out.println("Configuring GS2Search...");
    7686    config_info_ = info;
     87
     88    // Get the default index out of <defaultIndex> (buildConfig.xml)
     89    Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_ELEM);
     90    if (def != null) {
     91        default_index_ = def.getAttribute(GSXML.NAME_ATT);
     92    }
     93    if (default_index_ == null || default_index_.equals("")) {
     94        System.err.println("Error: default index not specified!");
     95        return false;
     96    }
    7797
    7898    // these entries should reflect the build config file - some services may not be available depending on how the colleciton was built.
     
    103123
    104124    /** creates a new param element and adds it to the param list */
    105     protected void createParameter(String name, Element param_list, boolean display,
    106                    String lang)
     125    protected void createParameter(String name, Element param_list,
     126                   boolean display, String lang)
    107127    {
    108128    Element param=null;
     
    162182     * otherwise it creates the description version
    163183     */
    164     protected boolean createTextQueryParamList(Element param_list, boolean display,
    165                            String lang)
    166     {
    167     // the order they are specified here is the order they appear on
    168     // the query form
    169     createParameter(CASE_PARAM, param_list, display, lang);
    170     createParameter(STEM_PARAM, param_list, display, lang);
    171     createParameter(MATCH_PARAM, param_list, display, lang);
    172     createParameter(MAXDOCS_PARAM, param_list, display, lang);
    173     createParameter(QUERY_PARAM, param_list, display, lang);
    174     return true;
    175     }
    176 
     184    protected abstract boolean createTextQueryParamList(Element param_list,
     185                            boolean display,
     186                            String lang);
    177187
    178188    /** creates a display element containing all the text strings needed to display
     
    182192    // Create a service display for the basic text query service
    183193    Element display = doc_.createElement(GSXML.DISPLAY_ELEM);
    184     display.appendChild(GSXML.createTextElement(doc_, GSXML.DISPLAY_NAME_ELEM,
    185                             getTextString(service+".name", lang)));
    186     display.appendChild(GSXML.createTextElement(doc_, GSXML.DISPLAY_SUBMIT_ELEM,
    187                             getTextString(service+".submit", lang)));
     194    display.appendChild(GSXML.createTextElement(doc_, GSXML.DISPLAY_NAME_ELEM, getTextString(service+".name", lang)));
     195    display.appendChild(GSXML.createTextElement(doc_, GSXML.DISPLAY_SUBMIT_ELEM, getTextString(service+".submit", lang)));
    188196
    189197    // now need to add in the params
Note: See TracChangeset for help on using the changeset viewer.