Changeset 73644644566a2ef9791d80ee31ab66770be83046

Show
Ignore:
Timestamp:
04/27/08 21:33:05 (8 months ago)
Author:
David Balmain <dbalmain@…>
Parents:
15dee3043d3e551973defb68d67022123989c1fa
Children:
56424f8d1cfd0e927e5e8f9e0c4329531221a966
git-committer:
David Balmain <dbalmain@gmail.com> / 2008-04-27T21:33:05Z+1000
Message:

Fixed bug in sloppy PhraseQuery

Phrase positions wheren't being sorted consistantly causing inconsistant search
results.

Location:
c
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • c/src/q_phrase.c

    r0c11a5 r736446  
    117117static bool pp_less_than(const PhPos *pp1, const PhPos *pp2) 
    118118{ 
    119     /* docs will all be equal when this method is used */ 
    120     return pp1->position < pp2->position; 
    121     /* 
    122     if (PP(p)->doc == PP(p)->doc) { 
    123         return PP(p)->position < PP(p)->position; 
     119    if (pp1->position == pp2->position) { 
     120        return pp1->offset > pp2->offset; 
    124121    } 
    125122    else { 
    126         return PP(p)->doc < PP(p)->doc; 
    127     } 
    128     */ 
     123        return pp1->position < pp2->position; 
     124    } 
    129125} 
    130126 
     
    235231    return raw_score * sim_decode_norm( 
    236232        self->similarity, 
    237         phsc->norms[phsc->phrase_pos[phsc->pp_first_idx]->doc]); 
     233        phsc->norms[self->doc]); 
    238234} 
    239235 
     
    279275    phsc_skip_to(self, doc_num); 
    280276 
    281     phrase_freq = (self->doc == doc_num) ? phsc->freq : (float)0.0; 
     277    phrase_freq = (self->doc == doc_num) ? phsc->freq : 0.0f; 
    282278    return expl_new(sim_tf(self->similarity, phrase_freq), 
    283279                    "tf(phrase_freq=%f)", phrase_freq); 
  • c/test/test.c

    r15dee3 r736446  
    259259 
    260260    dptr = suite->head; 
    261     fprintf(stdout, "%-15s\t\tTotal\tFail\tFailed %%\n", "Failed Tests"); 
     261    fprintf(stdout, "%-24sTotal\tFail\tFailed %%\n", "Failed Tests"); 
    262262    fprintf(stdout, "===================================================\n"); 
    263263    while (dptr != NULL) { 
  • c/test/test_search.c

    r2142bb r736446  
    162162    {"20050930", "word1", 
    163163        "cat1/",                ".123"}, 
    164     {"20051001", "word1 word2 the quick brown fox", 
     164    {"20051001", "word1 word2 the quick brown fox the quick brown fox", 
    165165        "cat1/sub1",            "0.954"}, 
    166166    {"20051002", "word1 word3",