Changeset 9266
- Timestamp:
- 2005-03-03T16:25:02+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractSearch.java
r9002 r9266 46 46 // compulsory params 47 47 protected static final String INDEX_PARAM = "index"; 48 protected static final String QUERY_PARAM = "query"; 49 50 // optional standard params - some of these have to be implemented 48 51 protected static final String MAXDOCS_PARAM = "maxDocs"; 49 protected static final String QUERY_PARAM = "query";50 51 // optional standard params52 52 protected static final String HITS_PER_PAGE_PARAM = "hitsPerPage"; 53 53 protected static final String START_PAGE_PARAM = "startPage"; … … 64 64 65 65 protected boolean does_paging = false; 66 protected boolean does_chunking = true; 66 67 protected String default_document_type = null; 67 68 … … 70 71 } 71 72 73 /** sets up the short service info for TextQuery. If other services 74 * will be provided, should be added in the subclass configure 75 * also looks for search format info, and document format info 76 */ 72 77 public boolean configure(Element info, Element extra_info) 73 78 { … … 122 127 } 123 128 129 /** returns the description of the TextQuery service. If a subclass 130 * provides other services they need to provides their own descriptions */ 124 131 protected Element getServiceDescription(String service, String lang, String subset) 125 132 { … … 146 153 } 147 154 148 abstract protected Element processTextQuery(Element request); 149 150 155 /** adds the standard query params into the service description */ 151 156 protected void addStandardQueryParams(Element param_list, String lang) 152 157 { 153 158 createParameter(INDEX_PARAM, param_list, lang); 154 createParameter(MAXDOCS_PARAM, param_list, lang); 159 if (does_chunking) { 160 createParameter(MAXDOCS_PARAM, param_list, lang); 161 } 155 162 if (does_paging) { 156 163 createParameter(HITS_PER_PAGE_PARAM, param_list, lang); … … 160 167 } 161 168 162 169 /** adds any service specific query params into the service 170 * default implementation: add nothing. subclasses may need to 171 * override this to add in their specific parameters 172 */ 163 173 protected void addCustomQueryParams(Element param_list, String lang) 164 174 { … … 253 263 } 254 264 255 abstract protected void getIndexData(ArrayList index_ids, ArrayList index_names, String lang);256 265 257 266 /** returns the document type of the doc that the specified node … … 260 269 GSXML.DOC_TYPE_PAGED, 261 270 GSXML.DOC_TYPE_HIERARCHY 271 default implementation returns GSXML.DOC_TYPE_SIMPLE, over ride 272 if documents can be hierarchical 262 273 */ 263 abstract protected String getDocType(String node_id); 274 protected String getDocType(String node_id) { 275 return GSXML.DOC_TYPE_SIMPLE; 276 } 264 277 265 /** returns true if the node has child nodes */ 266 abstract protected boolean hasChildren(String node_id); 267 /** returns true if the node has a parent */ 268 abstract protected boolean hasParent(String node_id); 269 270 } 271 278 /** returns true if the node has child nodes 279 * default implementation returns false, over ride if documents can be 280 * hierarchical 281 */ 282 protected boolean hasChildren(String node_id) { 283 return false; 284 } 285 /** returns true if the node has a parent 286 * default implementation returns false, over ride if documents can be 287 * hierarchical*/ 288 protected boolean hasParent(String node_id) { 289 return false; 290 } 291 292 /** do the actual query 293 * must be implemented by subclass */ 294 abstract protected Element processTextQuery(Element request); 295 296 /** get the details about the indexes available 297 * must be implemented by subclass 298 * there must be at least one index */ 299 abstract protected void getIndexData(ArrayList index_ids, ArrayList index_names, String lang); 300 301 } 302
Note:
See TracChangeset
for help on using the changeset viewer.