Changeset 10193
- Timestamp:
- 2005-06-29T16:59:36+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/IViaSearch.java
r10093 r10193 31 31 32 32 protected String ivia_server_url = null; 33 33 protected ArrayList index_ids = null; 34 34 public IViaSearch() 35 35 { … … 56 56 does_multi_index_search = true; 57 57 this.default_index = ",kw,au,su,ti,de,fu,"; // all of them 58 index_ids = new ArrayList(); 59 index_ids.add("kw"); 60 index_ids.add("au"); 61 index_ids.add("su"); 62 index_ids.add("ti"); 63 index_ids.add("de"); 64 index_ids.add("fu"); 65 58 66 return true; 59 67 } … … 88 96 // check for fields 89 97 String fields = (String) params.get(INDEX_PARAM); 90 if (fields != null && !fields.equals("")) { 98 fields = checkFieldParam(fields); // removes invalid fields 99 if (!fields.equals("")) { 91 100 url_string += "&fields="+fields; 92 101 } 93 94 102 //check for hits per page 95 103 String hits_per_page = (String) params.get(HITS_PER_PAGE_PARAM); … … 151 159 } 152 160 153 161 protected String checkFieldParam(String fields) { 162 163 if (fields == null) { 164 // return the default 165 return ""; 166 } 167 StringBuffer new_fields = new StringBuffer(); 168 String [] ids = fields.split(","); 169 for (int i=0; i<ids.length; i++) { 170 if(index_ids.contains(ids[i])) { 171 new_fields.append(ids[i]); 172 new_fields.append(","); 173 } 174 } 175 if (new_fields.length() == 0) { 176 return ""; 177 } 178 return new_fields.toString(); 179 } 154 180 /** 155 181 An IVia server has a fixed list of fields to search (I think) so we can hard code them here rather than reading them in from a config file 156 182 */ 157 183 protected void getIndexData(ArrayList index_ids, ArrayList index_names,String lang){ 158 index_ids.add("kw"); 159 index_ids.add("au"); 160 index_ids.add("su"); 161 index_ids.add("ti"); 162 index_ids.add("de"); 163 index_ids.add("fu"); 184 index_ids.addAll(this.index_ids); 164 185 index_names.add(getTextString("param."+INDEX_PARAM+".kw", lang)); 165 186 index_names.add(getTextString("param."+INDEX_PARAM+".au", lang));
Note:
See TracChangeset
for help on using the changeset viewer.