Changeset 7414
- Timestamp:
- 2004-05-25T11:02:29+12:00 (20 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/OIDtools.cpp
r2261 r7414 66 66 if (*here == '.') parents.push_back(thisparent); 67 67 thisparent.push_back(*here); 68 here ++;68 ++here; 69 69 } 70 70 } … … 75 75 // metadata fields are to be requested. 76 76 77 bool get_info (const text_t &OID, const text_t &collection, 77 bool get_info (const text_t &OID, const text_t &collection, const text_t &lang, 78 78 const text_tset &metadata, bool getParents, 79 79 recptproto *collectproto, FilterResponse_t &response, … … 87 87 88 88 request.filterName = "NullFilter"; 89 request.filterLang = lang; 89 90 request.filterResultOptions = FRmetadata; 90 91 request.getParents = getParents; … … 107 108 108 109 // overloaded, to allow "custom" filter options. 109 bool get_info (const text_t &OID, const text_t &collection, 110 bool get_info (const text_t &OID, const text_t &collection, const text_t &lang, 110 111 const text_tset &metadata, const OptionValue_tarray &options, 111 112 bool getParents, … … 119 120 120 121 request.filterName = "NullFilter"; 122 request.filterLang = lang; 121 123 request.filterResultOptions = FRmetadata; 122 124 request.getParents = getParents; … … 139 141 } 140 142 141 bool get_info (const text_tarray &OIDs, const text_t &collection, 143 bool get_info (const text_tarray &OIDs, const text_t &collection, const text_t &lang, 142 144 const text_tset &metadata, bool getParents, 143 145 recptproto *collectproto, FilterResponse_t &response, … … 151 153 152 154 request.filterName = "NullFilter"; 155 request.filterLang = lang; 153 156 request.filterResultOptions = FRmetadata; 154 157 request.getParents = getParents; … … 172 175 173 176 // has_children returns true if OID has children 174 bool has_children (const text_t &OID, const text_t &collection, 177 bool has_children (const text_t &OID, const text_t &collection, const text_t &lang, 175 178 recptproto *collectproto, ostream &logout) { 176 179 … … 179 182 metadata.insert ("haschildren"); 180 183 181 if (get_info (OID, collection, metadata, false, collectproto, response, logout)) {184 if (get_info (OID, collection, lang, metadata, false, collectproto, response, logout)) { 182 185 if (response.docInfo[0].metadata["haschildren"].values[0] == "1") 183 186 return true; … … 191 194 // with whatever metadata fields are to be requested. 192 195 193 bool get_children (const text_t &OID, const text_t &collection, 196 bool get_children (const text_t &OID, const text_t &collection, const text_t &lang, 194 197 const text_tset &metadata, bool getParents, 195 198 recptproto *collectproto, FilterResponse_t &response, … … 206 209 request.filterOptions.push_back (option); 207 210 request.filterName = "BrowseFilter"; 211 request.filterLang = lang; 208 212 request.filterResultOptions = FROID | FRmetadata; 209 213 request.fields = metadata; … … 250 254 if (*here == '"') temp += parent; 251 255 else temp.push_back (*here); 252 here ++;256 ++here; 253 257 } 254 258 OID = temp; … … 290 294 291 295 static void recurse_contents (ResultDocInfo_t section, const bool &is_classify, 292 const text_t &collection, const text_tset &metadata, 296 const text_t &collection, const text_t &lang, 297 const text_tset &metadata, 293 298 recptproto *collectproto, FilterResponse_t &response, 294 299 ostream &logout) { … … 300 305 FilterResponse_t tmp; 301 306 bool getParents = false; 302 get_children (section.OID, collection, metadata, getParents, collectproto, tmp, logout);307 get_children (section.OID, collection, lang, metadata, getParents, collectproto, tmp, logout); 303 308 ResultDocInfo_tarray::iterator thisdoc = tmp.docInfo.begin(); 304 309 ResultDocInfo_tarray::iterator lastdoc = tmp.docInfo.end(); 305 310 while (thisdoc != lastdoc) { 306 311 response.docInfo.push_back (*thisdoc); 307 recurse_contents (*thisdoc, is_classify, collection, metadata,312 recurse_contents (*thisdoc, is_classify, collection, lang, metadata, 308 313 collectproto, response, logout); 309 thisdoc ++;314 ++thisdoc; 310 315 } 311 316 } … … 315 320 // below (and including) OID. 316 321 void get_contents (const text_t &topOID, const bool &is_classify, 317 text_tset &metadata, const text_t &collection, 322 text_tset &metadata, const text_t &collection, const text_t &lang, 318 323 recptproto *collectproto, FilterResponse_t &response, 319 324 ostream &logout) { … … 326 331 327 332 // get topOIDs info 328 if (get_info (topOID, collection, metadata, false, collectproto, response, logout)) 329 recurse_contents (response.docInfo[0], is_classify, collection, 330 metadata, collectproto, response, logout); 333 if (get_info (topOID, collection, lang, metadata, false, collectproto, response, logout)) { 334 recurse_contents (response.docInfo[0], is_classify, collection, lang, 335 metadata, collectproto, response, logout); 336 } 331 337 } 332 338 -
trunk/gsdl/src/recpt/OIDtools.h
r1347 r7414 31 31 #include "recptproto.h" 32 32 33 void get_oid (const text_t &OID, text_t &to, size_t level); 34 33 35 // returns (in top) the top level of OID (i.e. everything 34 36 // up until the first dot) … … 45 47 // associated with OID. Metadata should be loaded with whatever 46 48 // metadata fields are to be requested 47 bool get_info (const text_t &OID, const text_t &collection, 49 bool get_info (const text_t &OID, const text_t &collection, const text_t &lang, 48 50 const text_tset &metadata, bool getParents, 49 51 recptproto *collectproto, FilterResponse_t &response, 50 52 ostream &logout); 51 bool get_info (const text_t &OID, const text_t &collection, 53 bool get_info (const text_t &OID, const text_t &collection, const text_t &lang, 52 54 const text_tset &metadata, const OptionValue_tarray &options, 53 55 bool getParents, 54 56 recptproto *collectproto, FilterResponse_t &response, 55 57 ostream &logout); 56 bool get_info (const text_tarray &OIDs, const text_t &collection, 58 bool get_info (const text_tarray &OIDs, const text_t &collection, const text_t &lang, 57 59 const text_tset &metadata, bool getParents, 58 60 recptproto *collectproto, FilterResponse_t &response, … … 60 62 61 63 // has_children returns true if OID has children 62 bool has_children (const text_t &OID, const text_t &collection, 64 bool has_children (const text_t &OID, const text_t &collection, const text_t &lang, 63 65 recptproto *collectproto, ostream &logout); 66 bool has_text(const text_t &OID, const text_t &collection, const text_t &lang, 67 recptproto *collectproto, ostream &logout); 68 69 inline bool has_text(MetadataInfo_tmap& metadata) 70 { 71 if (metadata["hastxt"].values.size() > 0) { 72 return metadata["hastxt"].values[0].getint() != 0; 73 } 74 return false; 75 } 76 77 inline bool has_children(MetadataInfo_tmap& metadata) 78 { 79 if (metadata["haschildren"].values.size() > 0) { 80 return metadata["haschildren"].values[0].getint() != 0; 81 } 82 return false; 83 } 64 84 65 85 // get_children does a protocol call and returns (in response) the OIDs and 66 86 // metadata of all the children of OID. The metadata set should be loaded 67 87 // with whatever metadata fields are to be requested. 68 bool get_children (const text_t &OID, const text_t &collection, 88 bool get_children (const text_t &OID, const text_t &collection, const text_t &lang, 69 89 const text_tset &metadata, bool getParents, 70 90 recptproto *collectproto, FilterResponse_t &response, … … 93 113 // below (and including) OID. 94 114 void get_contents (const text_t &topOID, const bool &is_classify, 95 text_tset &metadata, const text_t &collection, 115 text_tset &metadata, const text_t &collection, const text_t &lang, 96 116 recptproto *collectproto, FilterResponse_t &response, 97 117 ostream &logout);
Note:
See TracChangeset
for help on using the changeset viewer.