Changeset 14183


Ignore:
Timestamp:
2007-06-15T22:28:11+12:00 (14 years ago)
Author:
xiao
Message:

instead of simply retrieving the first child of format element in the search element, modify to find the format element which has at least one gsf:template child element

File:
1 edited

Legend:

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

    r14002 r14183  
    124124    if (format==null) {
    125125        String path = GSPath.appendLink(GSXML.SEARCH_ELEM, GSXML.FORMAT_ELEM);
    126         format = (Element) GSXML.getNodeByPath(extra_info, path);
    127     }
    128     //Element format = (Element) GSXML.getChildByTagName(info, GSXML.FORMAT_ELEM);
     126
     127      //note by xiao: instead of retrieving the first 'format' element inside the 'search'
     128      // element, we are trying to find the real format element which has at least one
     129      // 'gsf:template' child element. (extra_info is collectionConfig.xml)
     130      //format = (Element) GSXML.getNodeByPath(extra_info, path);
     131      Element search_elem = (Element) GSXML.getChildByTagName(extra_info, GSXML.SEARCH_ELEM);
     132      NodeList format_elems = null;
     133      if (search_elem != null) {
     134        format_elems = search_elem.getElementsByTagName(GSXML.FORMAT_ELEM);
     135      }
     136      for(int i=0; i<format_elems.getLength(); i++) {
     137          format = (Element)format_elems.item(i);
     138          if (format.getElementsByTagName("gsf:template").getLength() != 0) {
     139            break;
     140          }
     141      }
     142    }//end of if(format==null)
     143    //
    129144    if (format != null) {
    130145        this.format_info_map.put(TEXT_QUERY_SERVICE, this.doc.importNode(format, true));
Note: See TracChangeset for help on using the changeset viewer.