Changeset 1809
- Timestamp:
- 2000-12-19T12:08:17+13:00 (23 years ago)
- Location:
- trunk/gsdl/src/phind
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/client/ResultBox.java
r1635 r1809 248 248 boolean parseLine() { 249 249 250 250 // System.out.println("parseLine " + finished + "(" + expansionsRetrieved + ")"); 251 251 String item; 252 252 int eol = buffer.indexOf((int) '\n'); … … 296 296 297 297 } 298 299 // The <phinderror> tag contains an error message 300 else if (buffer.startsWith("<phinderror")) { 301 item = buffer.substring(0, eol); 302 System.out.println("phind reported an error: " + item); 303 buffer = buffer.substring(eol + 1); 304 return true; 305 } 298 306 299 307 // Ignore the piece we've read … … 412 420 // 413 421 // Given a string containing an XML expansin tag of the form: 414 // <expansion num="3" id="8421" text="PEOPLE and TREES" tf="3" df="3"/>415 // <expansion num="4" id="8696" text="FOREST TREES" tf="3" df="3"/>422 // <expansion num="3" id="8421" prefix="PEOPLE and" suffix="" tf="3" df="3"/> 423 // <expansion num="4" id="8696" prefix="" suffix="products" tf="3" df="3"/> 416 424 // Create a new ResultItem for display 417 425 // … … 461 469 line = line.substring(8); 462 470 nextSplit = line.indexOf((int) '"'); 463 if (nextSplit >= 1) {471 if (nextSplit >= 0) { 464 472 prefix = line.substring(0, nextSplit); 465 473 line = line.substring(nextSplit + 1); … … 473 481 line = line.substring(8); 474 482 nextSplit = line.indexOf((int) '"'); 475 if (nextSplit >= 1) {483 if (nextSplit >= 0) { 476 484 suffix = line.substring(0, nextSplit); 477 485 line = line.substring(nextSplit + 1); … … 480 488 } 481 489 } 482 483 // Read the text of the phrase484 // else if (line.startsWith("text")) {485 //line = line.substring(6);486 //nextSplit = line.indexOf((int) '"');487 //if (nextSplit >= 1) {488 // body = line.substring(0, nextSplit);489 // line = line.substring(nextSplit + 1);490 //} else {491 // System.err.println("ResultBox addExpansionTag: error parsing: " + line);492 //}493 //}494 490 495 491 // Read the frequency -
trunk/gsdl/src/phind/host/phindcgi.cpp
r1803 r1809 98 98 UCArray &title, UCArray &hash); 99 99 100 void cgi_error( char *message);100 void cgi_error(bool XMLmode, char *message); 101 101 102 102 void toUCArray(text_t &in, UCArray &out); … … 127 127 128 128 if (gsdlhome == NULL) { 129 cgi_error( "GSDLHOME not set in gsdlsite.cfg file.");129 cgi_error(XMLmode, "GSDLHOME not set in gsdlsite.cfg file."); 130 130 } 131 131 … … 137 137 138 138 if (collection == NULL) { 139 cgi_error( "No collection");139 cgi_error(XMLmode, "No collection"); 140 140 } 141 141 … … 150 150 151 151 if (word.empty()) { 152 cgi_error( "No phrase number or word.");152 cgi_error(XMLmode, "No phrase number or word."); 153 153 } 154 154 … … 157 157 158 158 if (result.empty()) { 159 c out << "couldn't find word: " << word << endl;159 cgi_error(XMLmode, "The search term does not occur in the collection."); 160 160 exit(0); 161 161 } else { … … 326 326 327 327 if (XMLmode) { 328 // body is always the same as the text of the phrase, so no need to send it 328 329 cout << "<expansion num=\"" << e 329 330 << "\" id=\"" << phrase 330 << "\" prefix=\"" << prefix 331 << "\" prefix=\"" << prefix 331 332 << "\" suffix=\"" << suffix 332 << "\" text=\"" << word333 333 << "\" tf=\"" << tf 334 334 << "\" df=\"" << df << "\"/>" << endl; … … 745 745 // page and exit(0) the program. 746 746 747 void cgi_error(char *message){ 748 749 cout << "Content-type: text/html" << endl << endl 750 << "<html><head><title>phind error</title></head>" << endl 751 << "<body>" << endl 752 << "<p><h1>phind error</h1>" 753 << "<p> An error occured processing your request: <p><b>" 754 << message 755 << "</b></body></html>" << endl; 747 void cgi_error(bool XMLmode, char *message) { 748 749 if (XMLmode) { 750 cout << "Content-type: text/plain" << endl << endl 751 << "<phinddata>" << endl 752 << "<phinderror>" << message << "</phinderror>" << endl 753 << "</phinddata>" << endl; 754 } else { 755 cout << "Content-type: text/html" << endl << endl 756 << "<html><head><title>phind error</title></head>" << endl 757 << "<body>" << endl 758 << "<p><h1>phind error</h1>" 759 << "<p> An error occured processing your request: <p><b>" 760 << message 761 << "</b></body></html>" << endl; 762 } 756 763 exit(0); 757 764 }
Note:
See TracChangeset
for help on using the changeset viewer.