Changeset 1900 for trunk/gsdl/src/recpt/z3950proto.cpp
- Timestamp:
- 2001-02-02T14:33:01+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/z3950proto.cpp
r1738 r1900 351 351 // go through options 352 352 text_t opt_term; // the term(s) that the user entered 353 int opt_querytype=0; // 1=>ranked (or), 2=>boolean (and) 353 354 text_t opt_fields; // which fields to search on 354 355 int opt_start=1, opt_end=20; // default values … … 357 358 OptionValue_tarray::iterator ov_end=request.filterOptions.end(); 358 359 while (ov_here != ov_end) { 359 // cerr << "OV pair: `" << ov_here->name.getcstr() << "'=`" 360 // << ov_here->value.getcstr() << "'\n"; 361 if (ov_here->name=="Term") 362 { 363 opt_term=ov_here->value; 364 } else if (ov_here->name=="Index") 365 { 366 opt_fields=ov_here->value; 367 } else if (ov_here->name=="StartResults") 368 { 369 opt_start=ov_here->value.getint(); 370 } else if (ov_here->name=="EndResults") 371 { 372 opt_end=ov_here->value.getint(); 373 } else if (ov_here->name=="Maxdocs") 374 { 375 maxdocs=ov_here->value.getint(); 376 } 360 if (ov_here->name=="Term") { 361 opt_term=ov_here->value; 362 } else if (ov_here->name=="QueryType") { 363 if (ov_here->value=="ranked") opt_querytype=1; 364 else if (ov_here->value=="boolean") opt_querytype=2; 365 else { /* error - shouldn't happen */ 366 /* currently unhandled */ 367 } 368 } else if (ov_here->name=="Index") { 369 opt_fields=ov_here->value; 370 } else if (ov_here->name=="StartResults") { 371 opt_start=ov_here->value.getint(); 372 } else if (ov_here->name=="EndResults") { 373 opt_end=ov_here->value.getint(); 374 } else if (ov_here->name=="Maxdocs") { 375 maxdocs=ov_here->value.getint(); 376 } 377 377 ov_here++; 378 378 } 379 379 err=noError; 380 380 text_tarray *titles=(*zserver)->getrecordTitles(opt_term, 381 opt_querytype, 381 382 opt_fields, 382 383 opt_start, // first to get … … 422 423 } // end of if (... & FRtermFreq) 423 424 424 } // end of if (... & FROID)425 } // end of if (... == "QueryFilter") 425 426 else { 426 427 // this wasn't a query action … … 443 444 response.docInfo.push_back(*docInfo); 444 445 } 445 } 446 } // end of not a query action 447 448 446 449 447 450 // Fill in metadata for each response.docInfo (if wanted) … … 450 453 // should check err returned here.... 451 454 452 // get the Query out of the filterOptions.453 text_t query="";454 text_t field="";455 OptionValue_tarray::iterator opt_here=request.filterOptions.begin();456 OptionValue_tarray::iterator opt_end=request.filterOptions.end();457 while (opt_here!=opt_end) {458 if (opt_here->name=="Query") {459 query=opt_here->value;460 if (field!="") break; // break from loop if we've got both461 } else if (opt_here->name=="Index") {462 field=opt_here->value;463 if (query!="") break; // break from loop if we've got both464 }465 opt_here++;466 }467 468 455 if (!request.fields.empty()) { 456 // currently, this is only true for NullFilter when getting the "Title" 457 // for a documentaction. 458 469 459 // loop on each document being returned 470 460 ResultDocInfo_tarray::iterator docs_here=response.docInfo.begin(); 471 461 ResultDocInfo_tarray::iterator docs_end=response.docInfo.end(); 472 462 while (docs_here!=docs_end) { 473 474 463 // loop on all the metadata fields in request.fields (type text_tset) 475 464 text_tset::iterator fields_here=request.fields.begin(); … … 489 478 i=request.docSet[0].getint(); 490 479 text_t doctext="unneeded"; 491 (*zserver)->getfullrecord(query, field, i, doctitle, doctext, err); 480 /* following variables aren't used, as our query result has been 481 cached in z3950server.cpp (but really we shouldn't know that 482 here...) But for the NullFilter, we don't get given these 483 again in the request, so for now we'll take advantage of this.*/ 484 485 int querytype=0; text_t field=""; 486 487 // get the Query out of the filterOptions. (we need get the Title) 488 text_t query=""; 489 OptionValue_tarray::iterator opthere=request.filterOptions.begin(); 490 OptionValue_tarray::iterator opt_end=request.filterOptions.end(); 491 while (opthere!=opt_end) { 492 if (opthere->name=="Query") { 493 query=opthere->value; 494 break; 495 } 496 opthere++; 497 } 498 (*zserver)->getfullrecord(query, querytype, field, i, doctitle, doctext, err); 492 499 // check err value! 493 500 docs_here->metadata["Title"].values.push_back(doctitle); 494 501 } else { 495 502 docs_here->metadata[*fields_here].values.push_back(""); 496 /////// cerr << " (not found)";497 503 } 498 504 fields_here++; … … 501 507 } // end of outer while loop 502 508 } // end of if (!request.fields.empty()) 503 509 504 510 else { // request.fields empty: return all metadata for about page or query 505 511 // we'll only put it in the first docInfo. … … 571 577 text_t query; // this should not be needed, as we have already connected to 572 578 // get the title.... 573 text_t field; // ditto... 574 (*zserver)->getfullrecord(query,field,request.OID.getint(), 579 int querytype; //ditto... 580 text_t field; // ditto... 581 (*zserver)->getfullrecord(query,querytype,field,request.OID.getint(), 575 582 title,doctext,err); 576 583 // check return value of above? (false=>not connected)
Note:
See TracChangeset
for help on using the changeset viewer.