Changeset 74

Show
Ignore:
Timestamp:
1999-09-20 15:19:27 (9 years ago)
Author:
olly
Message:

max msize no longer hard coded
can be set with --msize <number> in matchtest

Location:
trunk/xapian-core
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/xapian-core/common/match.h

    r73 r74  
    1616    
    1717        PostList *merger; 
    18 //        const int msize = 1000; 
     18        doccount max_msize; 
    1919 
    2020        // FIXME: try using a heap instead (C++ sect 18.8) 
     
    2525        bool add_pterm(const string&); 
    2626        void match(void); 
     27        void set_max_msize(doccount n) { max_msize = n; } 
    2728}; 
  • trunk/xapian-core/matcher/match.cc

    r71 r74  
    2020    return true; 
    2121} 
    22  
    23 #define MSIZE 1000 
    2422 
    2523typedef struct { 
     
    5048    } 
    5149 
    52     docid msize = 0, mtotal = 0; 
     50    doccount msize = 0, mtotal = 0; 
    5351    weight min = 0; 
    54     msetitem mset[MSIZE]; 
     52    msetitem *mset = new msetitem[max_msize]; 
    5553 
    5654    // FIXME: this method of building the M-set isn't very efficient 
     
    6765 
    6866            if (i == msize) { 
    69                 if (msize < MSIZE) { 
     67                if (msize < max_msize) { 
    7068                    mset[msize].id = id; 
    7169                    mset[msize].w = w; 
     
    7472            } else { 
    7573                int len; 
    76                 if (msize < MSIZE) msize++; 
     74                if (msize < max_msize) msize++; 
    7775                len = msize - i - 1; 
    7876                memmove(mset + i + 1, mset + i, len * sizeof(msetitem)); 
     
    8078                mset[i].w = w;           
    8179            } 
    82             if (msize == MSIZE) min = mset[MSIZE - 1].w; 
     80            if (msize == max_msize) min = mset[max_msize - 1].w; 
    8381        } 
    8482        mtotal++; 
  • trunk/xapian-core/tests/matchtest.cc

    r54 r74  
    1414        StemEn stemmer; 
    1515 
     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 
    1622        if (argc < 2) { 
    1723            cout << "Syntax: " << argv[0] << " TERM ..." << endl; 
    1824            exit(1); 
    19         } 
     25        }         
    2026        
    2127        for (char **p = argv + 1; *p; p++) {