+ if (isam_r[i] &&
+ (min < 0 ||
+ (r = (*parms->cmp)(isam_buf[i], isam_buf[min])) < 1))
+ min = i;
+ if (!isam_prev_buf)
+ {
+ pos_tf = xmalloc (sizeof(*pos_tf) * parms->no_isam_positions);
+ isam_prev_buf = xmalloc (info->key_size);
+ fact1 = 100000/parms->no_isam_positions;
+ fact2 = 100000/
+ (parms->no_isam_positions*parms->no_isam_positions);
+
+ no_occur = score_sum = 0;
+ memcpy (isam_prev_buf, isam_buf[min], info->key_size);
+ for (i = 0; i<parms->no_isam_positions; i++)
+ pos_tf[i] = -10;
+ }
+ else if (min < 0 ||
+ (*parms->cmp)(isam_buf[min], isam_prev_buf) > 1)
+ {
+ logf (LOG_LOG, "final occur = %d ratio=%d",
+ no_occur, score_sum / no_occur);
+ add_rec (info, score_sum / (10000.0*no_occur), isam_prev_buf);
+ if (min < 0)
+ break;
+ no_occur = score_sum = 0;
+ memcpy (isam_prev_buf, isam_buf[min], info->key_size);
+ for (i = 0; i<parms->no_isam_positions; i++)
+ pos_tf[i] = -10;
+ }
+ pos = (*parms->get_pos)(isam_buf[min]);
+ logf (LOG_LOG, "pos=%d", pos);
+ for (i = 0; i<parms->no_isam_positions; i++)
+ {
+ int d = pos - pos_tf[i];
+
+ no_occur++;
+ if (pos_tf[i] < 0 && i != min)
+ continue;
+ if (d < 10)
+ d = 10;
+ if (i == min)
+ score_sum += fact2 / d;
+ else
+ score_sum += fact1 / d;
+ }
+ pos_tf[min] = pos;
+ logf (LOG_LOG, "score_sum = %d", score_sum);
+ i = min;
+ if (isam_pt)
+ isam_r[i] = is_readkey (isam_pt[i], isam_buf[i]);
+ else if (isamc_pp)
+ isam_r[i] = isc_pp_read (isamc_pp[i], isam_buf[i]);
+ } /* while */
+ xfree (isam_prev_buf);
+ xfree (pos_tf);
+ break;
+ case RSREL_METHOD_A:
+ while (1)