Changeset 12912


Ignore:
Timestamp:
2006-09-28T16:52:34+12:00 (18 years ago)
Author:
kjdon
Message:

turned off accent folding if partial matching is being done - can't do them together due to the way the index works. also, do the accentfold cases for the switch in GetStemMethod only if ENABLE_ACCENTFOLD is defined

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/mgpp/text/GSDLQueryParser.cpp

    r12884 r12912  
    150150  /* Changed to use CHAR_FLAG_STEM* constants from mg_files.h */
    151151  while(here != end) {
    152     unsigned char ch = *here;
    153     if (strchr (CHAR_FLAG_STEM_Validator, ch) == NULL)
    154         return STEM_INVALID; // incorrect format
    155 
    156     switch(ch) {
    157         case CHAR_FLAG_STEM_CaseFold:       // ignore case (fold)
    158             stem |= STEM_CaseFolding;
    159             break;
    160         case CHAR_FLAG_STEM_NoCaseFold:     // case sensitive
    161             stem &= (~STEM_CaseFolding);
    162             break;
    163         case CHAR_FLAG_STEM_Stemming:       // stem words
    164             stem |= STEM_Stemming;
    165             break;
    166         case CHAR_FLAG_STEM_NoStemming:     // do not stem words
    167             stem &= (~STEM_Stemming);
    168             break;
    169         case CHAR_FLAG_STEM_AccentFold:     // accent fold
    170             stem |= STEM_AccentFolding;
    171             break;
    172         case CHAR_FLAG_STEM_NoAccentFold:   // do no accent folding
    173             stem &= (~STEM_AccentFolding);
    174             break;
    175     };
    176 
    177     ++here;     
     152    unsigned char ch = *here;
     153    if (strchr (CHAR_FLAG_STEM_Validator, ch) == NULL)
     154      return STEM_INVALID; // incorrect format
     155   
     156    switch(ch) {
     157    case CHAR_FLAG_STEM_CaseFold:       // ignore case (fold)
     158      stem |= STEM_CaseFolding;
     159      break;
     160    case CHAR_FLAG_STEM_NoCaseFold:     // case sensitive
     161      stem &= (~STEM_CaseFolding);
     162      break;
     163    case CHAR_FLAG_STEM_Stemming:       // stem words
     164      stem |= STEM_Stemming;
     165      break;
     166    case CHAR_FLAG_STEM_NoStemming:     // do not stem words
     167      stem &= (~STEM_Stemming);
     168      break;
     169#ifdef ENABLE_ACCENTFOLD
     170   case CHAR_FLAG_STEM_AccentFold:      // accent fold
     171      stem |= STEM_AccentFolding;
     172      break;
     173    case CHAR_FLAG_STEM_NoAccentFold:   // do no accent folding
     174      stem &= (~STEM_AccentFolding);
     175      break;
     176#endif
     177    };
     178   
     179    ++here;     
    178180  }
    179181  return stem;
     
    205207      termNode.stemMethod = (unsigned long)defaultStemMethod;
    206208    }
    207       }else here = oldHere; //ignore - wrong syntax
     209      } else here = oldHere; //ignore - wrong syntax
    208210
    209211    } else if (el.lexType == RangeE) {
     
    222224   
    223225    if (partial_match) {
    224       /* [JFG - Mar 06: Accent folding patch] */
    225       /* use STEM_PARTIAL_MATCH flag */
    226       termNode.stemMethod |= STEM_PARTIAL_MATCH;    // set partial match flag
    227       termNode.stemMethod &= (~STEM_Stemming);      // we dont have stemming on if doing partial matching.
     226      /* [JFG - Mar 06: Accent folding patch] */
     227      /* use STEM_PARTIAL_MATCH flag */
     228      termNode.stemMethod |= STEM_PARTIAL_MATCH; // set partial match flag
     229      termNode.stemMethod &= (~STEM_Stemming); // we dont have stemming on if doing partial matching.
     230      termNode.stemMethod &= (~STEM_AccentFolding); // we dont have accentfolding on if doing partial matching.
    228231    }
    229232    oldHere = here;
Note: See TracChangeset for help on using the changeset viewer.