Changeset 6082 for trunk/indexers/mgpp
- Timestamp:
- 2003-12-02T16:08:56+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/indexers/mgpp/text/GSDLQueryParser.cpp
r5449 r6082 217 217 // expects starting brackets to have been parsed 218 218 // sets error to true if something has gone wrong 219 static voidParseSquareBrackets(UCArray::const_iterator &here,219 static ProxMatchQueryNode *ParseSquareBrackets(UCArray::const_iterator &here, 220 220 UCArray::const_iterator end, 221 ProxMatchQueryNode *proxNode,221 /*ProxMatchQueryNode *proxNode,*/ 222 222 int defaultStemMethod, 223 223 bool & error) { 224 224 225 ProxMatchQueryNode *proxNode = new ProxMatchQueryNode; 225 226 LexEl el; 226 227 bool phrase=false; 227 228 bool first=true; 229 bool near = false; 230 UCArray near_string; 228 231 while (ParseLexEl (here, end, el)) { 229 232 if (el.lexType == TermE || el.lexType == IntegerE) { … … 237 240 termNode.endRange = -1; 238 241 } 239 } 242 } else if (near) { 243 SetRangeValues(termNode, near_string); 244 near = false; 245 } 240 246 proxNode->terms.push_back(termNode); 241 247 } … … 245 251 else if (el.lexType == QuoteE) { 246 252 // phrase inside square brackets 247 if (phrase) phrase=false; 248 else phrase=true; 249 } else if (el.lexType == UnknownE) { 253 if (phrase) { // end of phrase 254 phrase=false; 255 first = true; 256 } else { 257 phrase=true; // start of phrase 258 } 259 } else if (el.lexType == NearOpE) { 260 if (phrase) { 261 // cant have NEAR op in a phrase - just assume its an actual word 262 TermNode termNode; 263 termNode.term = el.text; 264 ParseTermModifiers (here, end, termNode, defaultStemMethod); 265 proxNode->terms.push_back(termNode); 266 } else { 267 // its a NEAR op 268 near = true; 269 near_string = el.text; 270 } 271 272 } 273 else if (el.lexType == UnknownE) { 250 274 // just ignore it 251 275 } … … 254 278 cerr <<"GSDLQueryParser: bad syntax inside []\n"; 255 279 error = true; 256 return ;280 return NULL; 257 281 } 258 282 } // while 259 283 return proxNode; 260 284 } 261 285 // expects the starting quote to have been parsed … … 354 378 else if (el.lexType == OpenSquareBracketE) { 355 379 bool error = false; 356 ParseSquareBrackets (here, end, proxNode,defaultStemMethod, error);380 proxNode = ParseSquareBrackets (here, end, /*proxNode, */defaultStemMethod, error); 357 381 if (error) { 358 382 delete proxNode;
Note:
See TracChangeset
for help on using the changeset viewer.