Changeset 13998


Ignore:
Timestamp:
2007-04-01T14:43:38+12:00 (15 years ago)
Author:
qq6
Message:

add INDEX_LANGUAGE_PARAM and INDEX_SUBCOLLECTION_PARAM

File:
1 edited

Legend:

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

    r13573 r13998  
    5454
    5555    // optional standard params - some of these have to be implemented
     56    protected static final String INDEX_SUBCOLLECTION_PARAM = "indexSubcollection";
     57    protected static final String INDEX_LANGUAGE_PARAM = "indexLanguage";
    5658    protected static final String MAXDOCS_PARAM = "maxDocs";
    5759    protected static final String HITS_PER_PAGE_PARAM = "hitsPerPage";
    5860    protected static final String START_PAGE_PARAM = "startPage";
     61
     62    protected static final String INDEX_SUBCOLLECTION_ELEM = "indexSubcollection";
     63    protected static final String INDEX_LANGUAGE_ELEM = "indexLanguage";
     64   
    5965
    6066    // some other common params that may be used
     
    8490    protected String default_index = "";
    8591
     92    protected String default_index_subcollection = "";
     93
     94    protected String default_index_language = "";
     95
    8696    public AbstractSearch()
    8797    {
     
    111121    // first look in buildConfig
    112122    Element format = (Element)GSXML.getChildByTagName(info, GSXML.FORMAT_ELEM);
    113    
     123
    114124    if (format==null) {
    115125        String path = GSPath.appendLink(GSXML.SEARCH_ELEM, GSXML.FORMAT_ELEM);
     
    185195    {
    186196    createParameter(INDEX_PARAM, param_list, lang);
     197        createParameter(INDEX_SUBCOLLECTION_PARAM,param_list, lang);
     198        createParameter(INDEX_LANGUAGE_PARAM,param_list, lang);
    187199    if (does_chunking) {
    188200        createParameter(MAXDOCS_PARAM, param_list, lang);
     
    225237        param = GSXML.createParameterDescription2(this.doc, INDEX_PARAM, getTextString("param."+INDEX_PARAM, lang), param_type, this.default_index, index_ids, index_names);
    226238        param_list.appendChild(param);
    227     } else if (name.equals(MAXDOCS_PARAM) || name.equals(HITS_PER_PAGE_PARAM)) {
     239    }
     240        else if (name.equals(INDEX_SUBCOLLECTION_PARAM)){
     241        Element index_sub_list = (Element)GSXML.getChildByTagName(this.config_info, INDEX_SUBCOLLECTION_ELEM+GSXML.LIST_MODIFIER);
     242         if (index_sub_list == null) return;
     243         ArrayList index_sub_ids = new ArrayList();
     244         ArrayList index_sub_names = new ArrayList();
     245        getIndexSubcollectionData(index_sub_ids, index_sub_names, lang);
     246        String param_type = GSXML.PARAM_TYPE_ENUM_SINGLE;
     247        if (does_multi_index_search) {
     248        param_type = GSXML.PARAM_TYPE_ENUM_MULTI;
     249        }
     250        param = GSXML.createParameterDescription2(this.doc, INDEX_SUBCOLLECTION_PARAM, getTextString("param."+INDEX_SUBCOLLECTION_PARAM, lang), param_type, this.default_index_subcollection, index_sub_ids, index_sub_names);
     251        param_list.appendChild(param);
     252    }
     253    else if(name.equals(INDEX_LANGUAGE_PARAM)){
     254        Element index_lang_list = (Element)GSXML.getChildByTagName(this.config_info, INDEX_LANGUAGE_ELEM+GSXML.LIST_MODIFIER);
     255            if (index_lang_list == null) return;
     256        ArrayList index_lang_ids = new ArrayList();
     257        ArrayList index_lang_names = new ArrayList();
     258        getIndexLanguageData(index_lang_ids, index_lang_names, lang);
     259        String param_type = GSXML.PARAM_TYPE_ENUM_SINGLE;
     260        if (does_multi_index_search) {
     261        param_type = GSXML.PARAM_TYPE_ENUM_MULTI;
     262        }
     263        param = GSXML.createParameterDescription2(this.doc, INDEX_LANGUAGE_PARAM, getTextString("param."+INDEX_LANGUAGE_PARAM, lang), param_type, this.default_index_language, index_lang_ids, index_lang_names);
     264        param_list.appendChild(param);
     265    }
     266        else if (name.equals(MAXDOCS_PARAM) || name.equals(HITS_PER_PAGE_PARAM)) {
    228267        String default_val = "100";
    229268        if (name.equals(HITS_PER_PAGE_PARAM)) {
     
    330369    abstract protected void getIndexData(ArrayList index_ids, ArrayList index_names, String lang);
    331370
     371    /** get the details about the indexexSubcollections available
     372     * might be implemented by subclass
     373     */
     374    protected void getIndexSubcollectionData(ArrayList index_ids, ArrayList index_names, String lang){}
     375   
     376    /** get the details about the indexes available
     377     * might be implemented by subclass
     378     */
     379    protected void getIndexLanguageData(ArrayList index_ids, ArrayList index_names, String lang){}
     380 
     381
    332382}
    333383
Note: See TracChangeset for help on using the changeset viewer.