Changeset 11002 for trunk/gsdl


Ignore:
Timestamp:
2005-12-19T10:59:40+13:00 (18 years ago)
Author:
kjdon
Message:

fixed up mg phrase searching. there was a bug where if you had two single word phrases, it would join the terms together and try to find that. also, now we don't do any phrase stuff if all phrases are only single words

File:
1 edited

Legend:

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

    r9937 r11002  
    2929#include <assert.h>
    3030#include "mgsearch.h"
     31#include "phrases.h"
    3132
    3233///////////////////////////////
     
    122123    if (tmpterms.size() > 1) {
    123124      phrases.push_back (tmpterms);
    124       tmpterms.erase (tmpterms.begin(), tmpterms.end());
    125     }
     125    }
     126    tmpterms.erase (tmpterms.begin(), tmpterms.end());
     127   
    126128    foundquote = false;
    127129    foundbreak = true;
     
    130132      // found a break between terms
    131133      if (!foundbreak && !start) {
    132     if (foundquote)
     134    if (foundquote) {
    133135      tmpterms.push_back (orgterms[termcount]);
     136    }
    134137    ++termcount;
    135138      }
     
    472475    // contains at least 2 double quotes (not very scientific but
    473476    // then neither is the rest of the mg phrase searching functionality :-)
    474     if (countchar ((*query_here).querystring.begin(), (*query_here).querystring.end(), '"') > 1) {
     477      //if (countchar ((*query_here).querystring.begin(), (*query_here).querystring.end(), '"') > 1) {
     478
     479    // [kjdon 12/2005] we don't want to do a phrase search if the only phrases are single words, so we'll parse out the phrases properly here
     480    text_tarray phrases;
     481    get_phrases((*query_here).querystring, phrases);
     482
     483    if (phrases.size() > 0) {
    475484      (*query_here).search_type = 0;
    476485
Note: See TracChangeset for help on using the changeset viewer.