Branch: Tag:

2013-02-05

2013-02-05 12:48:47 by Jonas Walldén <jonasw@roxen.com>

Revert "Fix phrase search when blob hit data isn't fully compacted." since
the main problem was traced to incorrect blob generation that was corrected in
1d8d7d4 and cb010f1. (Another logic bug remains that will be fixed in a
separate commit.)

This reverts commit 231560ec and 0c159c1e9.

211:    unsigned char *first = nhits+nblobs;    int matrix[65];    double accum = 0.0; -  int base_hit = -1; +        MEMSET(matrix, 0, sizeof(matrix) );   
231:    int h = m.raw;    if( (add = (*field_c)[ MOFF(m) ]) == 0.0 )    continue; -  if (h > base_hit) -  base_hit = h; +        for( j = 1; j<nblobs; j++)    for( k = first[j]; k<nhits[j]; k++ )
243:    first[j]=k;    if( h2-j == h )    hit++; -  if (h2 - j > base_hit) -  base_hit = h2 - j; +     break;    }    }
253:    accum += add/mc;    }    -  /* Determine which blobs to step forward */ -  if (base_hit >= 0) { -  int did_next = 0; -  for (i = 0; i < nblobs; i++) -  if (nhits[i]) { -  int max_hit = wf_blob_hit_raw(blobs[i], nhits[i] - 1); -  if (max_hit < base_hit + i) { -  wf_blob_next(blobs[i]); -  did_next = 1; -  } -  } -  if (!did_next) -  base_hit = -1; -  } -  if (base_hit < 0) { -  for (i = 0; i < nblobs; i++) -  wf_blob_next(blobs[i]); -  } -  +     free( nhits );       if( accum > 0.0 )
307:    while( 1 )    {    unsigned int min = 0x7fffffff; -  int test_phrase = 1; +        for( i = 0; i<nblobs; i++ )    if( blobs[i]->eof )
319:    goto end;       for( j = 0, i = 0; i < nblobs; i++ ) -  if( blobs[i]->docid != min ) { -  test_phrase = 0; -  break; -  } +  if( blobs[i]->docid != min ) +  goto next;    -  if (test_phrase) { -  /* Test if hit is valid and advance in some or all blobs */ +     handle_phrase_hit( blobs, nblobs, res, min, &field_c, max_c ); -  } else { +  +  next:    for( i = 0; i<nblobs; i++ )    if( blobs[i]->docid == min )    wf_blob_next( blobs[i] );    }    } -  } +    end:    /* Free workarea and return the result. */