Changeset 74
- Timestamp:
- 1999-09-20 15:19:27 (9 years ago)
- Location:
- trunk/xapian-core
- Files:
-
- 3 modified
-
common/match.h (modified) (2 diffs)
-
matcher/match.cc (modified) (5 diffs)
-
tests/matchtest.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xapian-core/common/match.h
r73 r74 16 16 17 17 PostList *merger; 18 // const int msize = 1000;18 doccount max_msize; 19 19 20 20 // FIXME: try using a heap instead (C++ sect 18.8) … … 25 25 bool add_pterm(const string&); 26 26 void match(void); 27 void set_max_msize(doccount n) { max_msize = n; } 27 28 }; -
trunk/xapian-core/matcher/match.cc
r71 r74 20 20 return true; 21 21 } 22 23 #define MSIZE 100024 22 25 23 typedef struct { … … 50 48 } 51 49 52 doc idmsize = 0, mtotal = 0;50 doccount msize = 0, mtotal = 0; 53 51 weight min = 0; 54 msetitem mset[MSIZE];52 msetitem *mset = new msetitem[max_msize]; 55 53 56 54 // FIXME: this method of building the M-set isn't very efficient … … 67 65 68 66 if (i == msize) { 69 if (msize < MSIZE) {67 if (msize < max_msize) { 70 68 mset[msize].id = id; 71 69 mset[msize].w = w; … … 74 72 } else { 75 73 int len; 76 if (msize < MSIZE) msize++;74 if (msize < max_msize) msize++; 77 75 len = msize - i - 1; 78 76 memmove(mset + i + 1, mset + i, len * sizeof(msetitem)); … … 80 78 mset[i].w = w; 81 79 } 82 if (msize == MSIZE) min = mset[MSIZE- 1].w;80 if (msize == max_msize) min = mset[max_msize - 1].w; 83 81 } 84 82 mtotal++; -
trunk/xapian-core/tests/matchtest.cc
r54 r74 14 14 StemEn stemmer; 15 15 16 if (argc >= 3 && strcmp(argv[1], "--msize") == 0) { 17 match.set_max_msize(atoi(argv[2])); 18 argc -= 2; 19 memmove(argv + 1, argv + 3, argc); 20 } 21 16 22 if (argc < 2) { 17 23 cout << "Syntax: " << argv[0] << " TERM ..." << endl; 18 24 exit(1); 19 } 25 } 20 26 21 27 for (char **p = argv + 1; *p; p++) {
