Ignore:
Timestamp:
1999-06-30T16:04:14+12:00 (25 years ago)
Author:
rjmcnab
Message:

made stemming functions available from mgsearch and made the stems
for the query terms available in queryinfo

File:
1 edited

Legend:

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

    r311 r319  
    1212/*
    1313   $Log$
     14   Revision 1.4  1999/06/30 04:04:13  rjmcnab
     15   made stemming functions available from mgsearch and made the stems
     16   for the query terms available in queryinfo
     17
    1418   Revision 1.3  1999/06/29 22:06:23  rjmcnab
    1519   Added a couple of fields to queryinfo to handle a special version
     
    8892{
    8993  termstr = t.termstr;
     94  termstemstr = t.termstemstr;
    9095  termfreq = t.termfreq;
    9196
     
    96101{
    97102  return ((x.termstr == y.termstr) &&
     103      (x.termstemstr == y.termstemstr) &&
    98104      (x.termfreq == y.termfreq));
    99105}
     
    108114{
    109115  return ((x.termfreq < y.termfreq) ||
    110       ((x.termfreq == y.termfreq) && (x.termstr < y.termstr)));
    111 
     116      ((x.termfreq == y.termfreq) && (x.termstemstr < y.termstemstr)) ||
     117      ((x.termfreq == y.termfreq) && (x.termstemstr == y.termstemstr) && (x.termstr < y.termstr)));
    112118}
    113119
     
    115121{
    116122  return ((x.termfreq > y.termfreq) ||
    117       ((x.termfreq == y.termfreq) && (x.termstr > y.termstr)));
    118 
     123      ((x.termfreq == y.termfreq) && (x.termstemstr > y.termstemstr)) ||
     124      ((x.termfreq == y.termfreq) && (x.termstemstr == y.termstemstr) && (x.termstr > y.termstr)));
    119125}
    120126
     
    125131
    126132  outs << text_t2ascii << " t:\"" << t.termstr << "\"";
     133  outs << text_t2ascii << " s:\"" << t.termstemstr << "\"";
    127134  outs << " f:" << t.termfreq << "\n";
    128135
     
    145152// query results
    146153
    147 void queryresultsclass::clear ()
    148 {
     154void queryresultsclass::clear () {
    149155  docs_matched_set = false;;
    150156  docs_matched = 0;
     
    152158 
    153159  docs.erase(docs.begin(),docs.end());
     160  orgterms.erase(orgterms.begin(),orgterms.end());
    154161  terms.erase(terms.begin(),terms.end());
    155162}
     
    168175}
    169176
    170 void queryresultsclass::sortqueryterms()
    171 {
     177void queryresultsclass::sortuniqqueryterms() {
     178  terms = orgterms;
     179
     180  // sort the terms
    172181  sort (terms.begin(), terms.end());
    173 }
    174 
    175 void queryresultsclass::uniqqueryterms()
    176 {
     182
     183  // and then unique them
    177184  vector<termfreqclass>::iterator new_end = unique (terms.begin(), terms.end());
    178185  terms.erase(new_end, terms.end());
    179186}
    180 
    181187
    182188
     
    192198    outs << (*docshere);
    193199    docshere++;
     200  }
     201
     202  outs << "orgterms\n";
     203  vector<termfreqclass>::iterator orgtermshere = q.orgterms.begin();
     204  vector<termfreqclass>::iterator orgtermsend = q.orgterms.end();
     205  while (orgtermshere != orgtermsend) {
     206    outs << (*orgtermshere);
     207    orgtermshere++;
    194208  }
    195209
Note: See TracChangeset for help on using the changeset viewer.