Changeset 324 for trunk/gsdl/src/colservr
- Timestamp:
- 1999-07-01T15:52:05+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/mgq.c
r319 r324 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/07/01 03:52:05 rjmcnab 15 Added a function to get the equivalent terms of a query term. I also 16 fixed a small bug that was causing massive slowdown :-^ 17 14 18 Revision 1.5 1999/06/30 04:04:11 rjmcnab 15 19 made stemming functions available from mgsearch and made the stems … … 67 71 #include "words.h" 68 72 #include "stemmer.h" 73 #include "stem_search.h" 69 74 70 75 #ifdef __cplusplus … … 214 219 } while (NextDoc (qd) && output_failure == 0 && --howmany > 0); 215 220 216 if (need_text) FreeTextBuffer (qd);221 /* if (need_text) FreeTextBuffer (qd);*/ 217 222 218 223 return (DocCount); … … 567 572 } 568 573 574 /* get all the terms that match wordstem using the current stemmer and */ 575 /* stemming method. The callback is the same style used by mgq_results */ 576 int mgq_equivterms (unsigned char *wordstem, int (*sender)(char *, int, int, float, void *), 577 void *ptr) { 578 int stem_method = 0; 579 query_data *qd = NULL; 580 TermList *equivterms = NULL; /* used for equivalent terms */ 581 582 if (cur_cachenum == -1) return 0; 583 qd = dbcache[cur_cachenum].qd; 584 if (qd == NULL || wordstem == NULL || sender == NULL) return 0; 585 586 if (qd->sd->sdh.indexed) { 587 stem_method = BooleanEnv(GetEnv("casefold"),0) | (BooleanEnv(GetEnv("stem"),0) << 1); 588 } else { 589 stem_method = qd->sd->sdh.stem_method; 590 } 591 592 /* make the term list */ 593 equivterms = MakeTermList (0); 594 595 /* expand out this word */ 596 if (FindWords (qd->sd, wordstem, stem_method, &equivterms) > 0) { 597 int i; 598 for (i=0; i < equivterms->num; i++) { 599 (* sender)((char *)(equivterms->TE[i].Word+1), equivterms->TE[i].Word[0], 600 equivterms->TE[i].Count, (float)0.0, ptr); 601 } 602 } 603 604 /* free the term list */ 605 if (equivterms != NULL) FreeTermList (&equivterms); 606 607 return 0; 608 } 569 609 570 610 /* use mgq_getmaxstemlen to determine the length of the word stems to pass */ … … 628 668 /* search for the index */ 629 669 i = search_gensuffix (gensuffix); 630 if (i > 0) {670 if (i >= 0) { 631 671 make_current (i); 632 672 return 1; -
trunk/gsdl/src/colservr/mgq.h
r319 r324 27 27 28 28 int mgq_ask(char *line); 29 int mgq_results(enum result_kinds kind, int skip, int howmany,29 int mgq_results(enum result_kinds kind, int skip, int howmany, 30 30 int (*sender)(char *, int, int, float, void *), void *ptr); 31 31 int mgq_numdocs(void); 32 32 int mgq_numterms(void); 33 33 34 /* get all the terms that match wordstem using the current stemmer and */ 35 /* stemming method. The callback is the same style used by mgq_results */ 36 int mgq_equivterms (unsigned char *wordstem, int (*sender)(char *, int, int, float, void *), 37 void *ptr); 38 34 39 /* use mgq_getmaxstemlen to determine the length of the word stems to pass */ 35 40 /* to mgq_stemword */
Note:
See TracChangeset
for help on using the changeset viewer.