Switch to unified view

a/src/query/wasastringtoquery.cpp b/src/query/wasastringtoquery.cpp
...
...
82
    }
82
    }
83
    if (desc[desc.length() - 1] == ' ')
83
    if (desc[desc.length() - 1] == ' ')
84
    desc.erase(desc.length() - 1);
84
    desc.erase(desc.length() - 1);
85
    desc += ")"; 
85
    desc += ")"; 
86
    if (m_modifiers != 0) {
86
    if (m_modifiers != 0) {
87
    if (m_modifiers & WQM_BOOST)  desc += "BOOST|";
87
    if (m_modifiers & WQM_BOOST)     desc += "BOOST|";
88
    if (m_modifiers & WQM_CASESENS)  desc += "CASESENS|";
88
    if (m_modifiers & WQM_CASESENS)  desc += "CASESENS|";
89
    if (m_modifiers & WQM_DIACSENS)  desc += "DIACSENS|";
89
    if (m_modifiers & WQM_DIACSENS)  desc += "DIACSENS|";
90
  if (m_modifiers & WQM_FUZZY)     desc += "FUZZY|";
90
    if (m_modifiers & WQM_NOSTEM)    desc += "NOSTEM|";
91
    if (m_modifiers & WQM_NOSTEM)    desc += "NOSTEM|";
91
  if (m_modifiers & WQM_BOOST)     desc += "BOOST|";
92
  if (m_modifiers & WQM_PHRASESLACK) desc += "PHRASESLACK|";
92
    if (m_modifiers & WQM_PROX)      desc += "PROX|";
93
    if (m_modifiers & WQM_PROX)      desc += "PROX|";
94
  if (m_modifiers & WQM_REGEX)     desc += "REGEX|";
93
    if (m_modifiers & WQM_SLOPPY)    desc += "SLOPPY|";
95
    if (m_modifiers & WQM_SLOPPY)    desc += "SLOPPY|";
94
    if (m_modifiers & WQM_WORDS)     desc += "WORDS|";
96
    if (m_modifiers & WQM_WORDS)     desc += "WORDS|";
95
  if (m_modifiers & WQM_PHRASESLACK) desc += "PHRASESLACK|";
96
  if (m_modifiers & WQM_REGEX)     desc += "REGEX|";
97
  if (m_modifiers & WQM_FUZZY)     desc += "FUZZY|";
98
    if (desc.length() > 0 && desc[desc.length()-1] == '|')
97
    if (desc.length() > 0 && desc[desc.length()-1] == '|')
99
        desc = desc.substr(0, desc.length()-1);
98
        desc = desc.substr(0, desc.length()-1);
100
    }
99
    }
101
    desc += " ";
100
    desc += " ";
102
}
101
}
...
...
130
        "[[:space:]]*)?"
129
        "[[:space:]]*)?"
131
      "("                            //8
130
      "("                            //8
132
        "(\""                        //9
131
        "(\""                        //9
133
          "([^\"]+)"                 //10 "A quoted term"
132
          "([^\"]+)"                 //10 "A quoted term"
134
        "\")"                        
133
        "\")"                        
135
        "([a-zA-Z0-9]*)"             //11 modifiers
134
        "([bcCdDeflLoprsw.0-9]*)"             //11 modifiers
136
        "|"
135
        "|"
137
        "([^[:space:]\"]+)"          //12 ANormalTerm
136
        "([^[:space:]\"]+)"          //12 ANormalTerm
138
      ")"
137
      ")"
139
    ")[[:space:]]*"
138
    ")[[:space:]]*"
140
;
139
;
...
...
150
     /* 6*/   "FIELD",
149
     /* 6*/   "FIELD",
151
     /* 7*/   "RELATION",
150
     /* 7*/   "RELATION",
152
     /* 8*/   "",
151
     /* 8*/   "",
153
     /* 9*/   "",
152
     /* 9*/   "",
154
     /*10*/   "QUOTEDTERM",
153
     /*10*/   "QUOTEDTERM",
155
     /*11*/   "MODIIFIERS",
154
     /*11*/   "MODIFIERS",
156
     /*12*/   "TERM",
155
     /*12*/   "TERM",
157
};
156
};
158
#define NMATCH (sizeof(matchNames) / sizeof(char *))
157
#define NMATCH (sizeof(matchNames) / sizeof(char *))
159
158
160
// Symbolic names for the interesting submatch indices
159
// Symbolic names for the interesting submatch indices
...
...
326
        if (checkSubMatch(SMI_MODIF, match, reason)) {
325
        if (checkSubMatch(SMI_MODIF, match, reason)) {
327
        DPRINT((stderr, "Got modifiers: [%s]\n", match));
326
        DPRINT((stderr, "Got modifiers: [%s]\n", match));
328
        unsigned int mods = 0;
327
        unsigned int mods = 0;
329
        for (unsigned int i = 0; i < strlen(match); i++) {
328
        for (unsigned int i = 0; i < strlen(match); i++) {
330
            switch (match[i]) {
329
            switch (match[i]) {
330
          case 'b': 
331
            case 'b': mods |= WasaQuery::WQM_BOOST; break;
331
          mods |= WasaQuery::WQM_BOOST; 
332
          nclause->m_weight = 10.0;
333
          break;
332
            case 'c': break;
334
            case 'c': break;
333
            case 'C': mods |= WasaQuery::WQM_CASESENS; break;
335
            case 'C': mods |= WasaQuery::WQM_CASESENS; break;
334
            case 'd': break;
336
            case 'd': break;
335
            case 'D': mods |= WasaQuery::WQM_DIACSENS; break;
337
            case 'D': mods |= WasaQuery::WQM_DIACSENS; break;
336
          case 'e': mods |= WasaQuery::WQM_CASESENS | WasaQuery::WQM_DIACSENS |  WasaQuery::WQM_NOSTEM; break;
338
          case 'e': mods |= WasaQuery::WQM_CASESENS | 
339
              WasaQuery::WQM_DIACSENS |  
340
              WasaQuery::WQM_NOSTEM; 
341
          break;
337
            case 'f': mods |= WasaQuery::WQM_FUZZY; break;
342
            case 'f': mods |= WasaQuery::WQM_FUZZY; break;
338
            case 'l': mods |= WasaQuery::WQM_NOSTEM; break;
343
            case 'l': mods |= WasaQuery::WQM_NOSTEM; break;
339
            case 'L': break;
344
            case 'L': break;
340
            case 'o': mods |= WasaQuery::WQM_PHRASESLACK; break;
345
            case 'o': mods |= WasaQuery::WQM_PHRASESLACK; break;
341
            case 'p': mods |= WasaQuery::WQM_PROX; break;
346
            case 'p': mods |= WasaQuery::WQM_PROX; break;
342
            case 'r': mods |= WasaQuery::WQM_REGEX; break;
347
            case 'r': mods |= WasaQuery::WQM_REGEX; break;
343
            case 's': mods |= WasaQuery::WQM_SLOPPY; break;
348
            case 's': mods |= WasaQuery::WQM_SLOPPY; break;
344
            case 'w': mods |= WasaQuery::WQM_WORDS; break;
349
            case 'w': mods |= WasaQuery::WQM_WORDS; break;
350
          case '.':case '0':case '1':case '2':case '3':case '4':
351
          case '5':case '6':case '7':case '8':case '9':
352
          {
353
          int n;
354
          float factor;
355
          if (sscanf(match+i, "%f %n", &factor, &n)) {
356
              nclause->m_weight = factor;
357
              DPRINT((stderr, "Got factor %.2f len %d\n",
358
                  factor, n));
359
          }
360
          if (n)
361
              i += n-1;
362
          }
345
            }
363
            }
346
        }
364
        }
347
        nclause->m_modifiers = WasaQuery::Modifier(mods);
365
        nclause->m_modifiers = WasaQuery::Modifier(mods);
348
        }
366
        }
349
367