Changeset 1770
- Timestamp:
- 2000-12-08T11:36:32+13:00 (23 years ago)
- Location:
- trunk/gsdl/src/mgpp/text
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/mgpp/text/GSDLQueryParser.cpp
r1296 r1770 28 28 static QueryNode *ParseExpression (UCArray::const_iterator &here, 29 29 UCArray::const_iterator end, 30 int defaultBoolCOmbine, 30 31 int defaultStemMethod); 31 32 … … 64 65 static QueryNode *ParseBracketExpression (UCArray::const_iterator &here, 65 66 UCArray::const_iterator end, 67 int defaultBoolCombine, 66 68 int defaultStemMethod) { 67 69 // get everything in the expression 68 QueryNode *curTree = ParseExpression (here, end, defaultStemMethod); 70 QueryNode *curTree = ParseExpression (here, end, defaultBoolCombine, 71 defaultStemMethod); 69 72 70 73 // gobble up tokens until a closing bracket is found … … 282 285 static QueryNode *ParseTerm (UCArray::const_iterator &here, 283 286 UCArray::const_iterator end, 287 int defaultBoolCombine, 284 288 int defaultStemMethod) { 285 289 LexEl el; … … 289 293 290 294 if (el.lexType == OpenBracketE) 291 return ParseBracketExpression (here, end, defaultStemMethod); 295 return ParseBracketExpression (here, end, defaultBoolCombine, 296 defaultStemMethod); 292 297 293 298 ProxMatchQueryNode *proxNode = new ProxMatchQueryNode; … … 300 305 if (ParseLexEl(here, end, el) && el.lexType == NearOpE) { 301 306 delete proxNode; 302 proxNode = (ProxMatchQueryNode *)ParseTerm(here, end, defaultStemMethod); 307 proxNode = (ProxMatchQueryNode *)ParseTerm(here, end, defaultBoolCombine, 308 defaultStemMethod); 303 309 SetRangeValues(termNode, el.text); 304 310 proxNode->terms.push_back (termNode); … … 330 336 static QueryNode *ParseExpression (UCArray::const_iterator &here, 331 337 UCArray::const_iterator end, 338 int defaultBoolCombine, 332 339 int defaultStemMethod) { 333 340 LexEl el; … … 344 351 // some type of term, back track and parse it 345 352 here = oldHere; 346 curTree = OrAdd (curTree, ParseTerm (here, end, defaultStemMethod)); 347 353 // if default==1, AND, else if==0, OR 354 if (defaultBoolCombine) { 355 curTree = AndAdd (curTree, ParseTerm (here, end, defaultBoolCombine, 356 defaultStemMethod)); 357 } 358 else { 359 curTree = OrAdd (curTree, ParseTerm (here, end, defaultBoolCombine, 360 defaultStemMethod)); 361 } 362 348 363 } else if (el.lexType == AndOpE) { 349 curTree = AndAdd (curTree, ParseTerm (here, end, defaultStemMethod)); 364 curTree = AndAdd (curTree, ParseTerm (here, end, defaultBoolCombine, 365 defaultStemMethod)); 350 366 351 367 } else if (el.lexType == OrOpE) { 352 curTree = OrAdd (curTree, ParseTerm (here, end, defaultStemMethod)); 368 curTree = OrAdd (curTree, ParseTerm (here, end, defaultBoolCombine, 369 defaultStemMethod)); 353 370 354 371 } else if (el.lexType == NotOpE) { 355 curTree = NotAdd (curTree, ParseTerm (here, end, defaultStemMethod)); 372 curTree = NotAdd (curTree, ParseTerm (here, end, defaultBoolCombine, 373 defaultStemMethod)); 356 374 357 375 } else if (el.lexType == CloseBracketE) { … … 368 386 } 369 387 370 QueryNode *ParseQuery (const UCArray &queryStr, int defaultStemMethod) { 388 QueryNode *ParseQuery (const UCArray &queryStr, int defaultBoolCombine, 389 int defaultStemMethod) { 371 390 UCArray::const_iterator here = queryStr.begin(); 372 391 UCArray::const_iterator end = queryStr.end(); 373 return ParseExpression (here, end, default StemMethod);374 } 392 return ParseExpression (here, end, defaultBoolCombine, defaultStemMethod); 393 } -
trunk/gsdl/src/mgpp/text/GSDLQueryParser.h
r1296 r1770 29 29 30 30 // returns NULL if the query could not be parsed 31 // defaultBoolCOmbine determines if individual terms are combined using 32 // AND or OR in the absence of specified operators. 31 33 // defaultStemMethod used to set stemming and casefolding for terms where 32 34 // its not set explicitly in the query string. THe defaultStemMethod value 33 35 // should be set using the values from the preferences page 34 QueryNode *ParseQuery (const UCArray &queryStr, int defaultStemMethod); 36 QueryNode *ParseQuery (const UCArray &queryStr, int defaultBoolCombine, 37 int defaultStemMethod); 35 38 36 39 #endif
Note:
See TracChangeset
for help on using the changeset viewer.