Ignore:
Timestamp:
1999-07-16T12:12:47+12:00 (25 years ago)
Author:
sjboddie
Message:

removed all the old post-processing stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/mgsearch.cpp

    r350 r393  
    1212/*
    1313   $Log$
     14   Revision 1.13  1999/07/16 00:12:46  sjboddie
     15   removed all the old post-processing stuff
     16
    1417   Revision 1.12  1999/07/07 06:17:47  rjmcnab
    1518   broke search_index into index+subcollection+language
     
    102105/////////////
    103106
    104 static char *quotedquery = NULL;
    105 static int casefold;
    106 
    107107static char *tempdoc = NULL;
    108108static int templen = 0;
     
    152152// it assumes that cache_num is set up correctly to point to
    153153// a suitable result cache
    154 int ourquerycallback(char *UDoc, int /*ULen*/, int DocNum,
     154int ourquerycallback(char */*UDoc*/, int /*ULen*/, int DocNum,
    155155             float Weight, void *info) {
    156156
    157157 
    158158  queryresultsclass *queryresults = (queryresultsclass * )info;
    159 
    160   // check the returned document for the presence of the
    161   // quoted part of the query, if there was one
    162  
    163   //  if (UDoc != NULL && quotedquery != NULL &&
    164   //    quotedquery[0] != '\0' && strstr (UDoc, quotedquery) == NULL) return 0;
    165  
    166  
    167   if (UDoc != NULL && quotedquery != NULL && quotedquery[0] != '\0') {
    168 
    169       if (casefold) {
    170           int len;
    171           for (len = 0; quotedquery[len] != '\0'; len ++)
    172               quotedquery[len] = tolower (quotedquery[len]);
    173           for (len = 0; UDoc[len] != '\0'; len ++)
    174               UDoc[len] = tolower (UDoc[len]);
    175       }
    176       if (strstr (UDoc, quotedquery) == NULL) return 0;
    177   }
    178159
    179160  // append this entry to the document results
     
    277258static text_t getindexsuffix (const text_t &collection,
    278259                  const text_t &index) {
    279   text_t indexsuffix = "index";
     260
     261  text_t indexsuffix = "index"; 
     262  // temporary hack so old version of niupepa collection
     263  // can stay up until new one's finished
     264  if (collection == "niupepa") indexsuffix = "index.new";
     265
    280266  indexsuffix = filename_cat (indexsuffix, index);
    281267  indexsuffix = filename_cat (indexsuffix, collection);
     
    386372  // the database was loaded)
    387373  if (queryhere == queryend) return true;
    388 
    389   casefold = queryparams.casefolding;
    390374
    391375  if (makeindexcurrent (queryparams.index, queryparams.subcollection,
     
    442426  // sort out the query string
    443427  text_t ttquerystring = queryparams.querystring;
    444   text_t ttquotedquery;
    445   //  extractquoted (ttquerystring, ttquotedquery);
    446428  filterquery (ttquerystring);
    447  
    448   // turn the strings into c strings for mg
    449   if (quotedquery != NULL) // quotedquery is a global
    450     {
    451       delete quotedquery;
    452       quotedquery = NULL;
    453     }
    454 
    455   // quotedquery will be deleted on the next call to this function
    456   quotedquery = to_utf8(ttquotedquery).getcstr ();
    457429  char *querystring = to_utf8(ttquerystring).getcstr();
    458430 
     
    466438void mgsearchclass::getresults (const queryparamclass &queryparams,
    467439                queryresultsclass &queryresults) {
    468   if (quotedquery[0] == '\0') {
    469     // don't need the text
    470     mgq_results(result_docnums, 0, MAXNUMDOCS,
    471         ourquerycallback, (void *)(&queryresults));
    472   } else {
    473     // we need the text for this one
    474     mgq_results(result_docs, 0, MAXNUMDOCS,
    475         ourquerycallback, (void *)(&queryresults));
    476   }
     440
     441  mgq_results(result_docnums, 0, MAXNUMDOCS,
     442          ourquerycallback, (void *)(&queryresults));
    477443 
    478444  // get the term frequencies
     
    501467  }
    502468}
    503 
    504 
    505 void mgsearchclass::extractquoted (text_t &ttquerystring, text_t &ttquotedquery)
    506 {
    507   ttquotedquery.clear();
    508 
    509   text_t::iterator ithere = ttquerystring.begin ();
    510   text_t::iterator itend = ttquerystring.end ();
    511 
    512   bool inquote = false;
    513 
    514   while (ithere != itend)
    515     {
    516       if ((*ithere) == '\"')
    517     {
    518       if (!inquote) ttquotedquery.clear ();
    519       inquote = !inquote;
    520       *ithere = ' '; // delete the quote
    521     }
    522       else if (inquote)
    523     {
    524       ttquotedquery.push_back(*ithere);
    525       *ithere = ' ';
    526     }
    527      
    528       ithere++;
    529     }
    530 }
    531 
    532469
    533470void mgsearchclass::filterquery (text_t &ttquerystring) {
Note: See TracChangeset for help on using the changeset viewer.