Changeset 8954


Ignore:
Timestamp:
2005-02-02T14:46:07+13:00 (19 years ago)
Author:
kjdon
Message:

if no field specified, use the default field (the first one in the list) rather than assuming ZZ which may not be there

File:
1 edited

Legend:

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

    r8723 r8954  
    7575    private static final String SEARCH_TYPE_PLAIN = "plain";
    7676    private static final String SEARCH_TYPE_FORM = "form";
    77     private static final String SEARCH_TYPE_FORM_SIMPLE = "simple";
     77    private static final String SEARCH_TYPE_FORM_SIMPLE = "simple";
    7878    private static final String SEARCH_TYPE_FORM_ADVANCED = "advanced";
    7979
     
    8888    // the default level for retrieval - and we'll use it for searching too
    8989    private String default_level=null;
     90    // the default field for searching
     91    private String default_field = null;
    9092    // which search services will we offer??
    9193    private boolean plain_search = false;
     
    9799    {
    98100    this.mgpp_src = new MGPPWrapper();
     101    this.dictionary_name = "MGPPSearch";
    99102    }
    100103
     
    176179        return true;
    177180    }
     181    // find the default field - use the first one
     182    Element first_field = (Element)GSXML.getChildByTagName(field_list, GSXML.FIELD_ELEM);
     183    default_field = first_field.getAttribute(GSXML.NAME_ATT);
    178184    // else set up the fielded query services
    179185   
     
    460466    }
    461467
    462     // If an field hasn't been specified, use all fields
     468    // If a field hasn't been specified, use the default
    463469    String field = (String) params.get(INDEX_FIELD_PARAM);
    464470    if (field == null) {
    465         field = "ZZ";
     471        field = default_field;
    466472    }
    467473   
Note: See TracChangeset for help on using the changeset viewer.