* Sebastian Hammer, Adam Dickmeiss
*
* $Log: trunc.c,v $
- * Revision 1.14 1999-05-26 07:49:13 adam
+ * Revision 1.15 1999-07-20 13:59:18 adam
+ * Fixed bug that occurred when phrases had 0 hits.
+ *
+ * Revision 1.14 1999/05/26 07:49:13 adam
* C++ compilation.
*
* Revision 1.13 1999/05/12 13:08:06 adam
const char *term, int length, const char *flags)
{
logf (LOG_DEBUG, "rset_trunc no=%d", no);
+ if (no < 1)
+ {
+ rset_null_parms parms;
+ parms.rset_term = rset_term_create (term, length, flags);
+ return rset_create (rset_kind_null, &parms);
+ }
if (zi->isam)
{
- if (no < 1)
- return rset_create (rset_kind_null, NULL);
- else if (no == 1)
+ if (no == 1)
{
rset_isam_parms parms;
}
else if (zi->isamc)
{
- if (no < 1)
- return rset_create (rset_kind_null, NULL);
- else if (no == 1)
+ if (no == 1)
{
rset_isamc_parms parms;
}
else if (zi->isams)
{
- if (no < 1)
- return rset_create (rset_kind_null, NULL);
- else if (no == 1)
+ if (no == 1)
{
rset_isams_parms parms;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.93 1999-06-17 14:38:40 adam
+ * Revision 1.94 1999-07-20 13:59:18 adam
+ * Fixed bug that occurred when phrases had 0 hits.
+ *
+ * Revision 1.93 1999/06/17 14:38:40 adam
* Bug fix: Scan SEGV'ed when getting unknown use attribute.
*
* Revision 1.92 1999/05/26 07:49:13 adam
return *s0;
}
+/* term_100: handle term, where trunc=none (no operators at all) */
static int term_100 (ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term)
return i;
}
+/* term_101: handle term, where trunc=Process # */
static int term_101 (ZebraMaps zebra_maps, int reg_type,
const char **src, char *dst, int space_split,
char *dst_term)
return i;
}
-
+/* term_103: handle term, where trunc=re-2 (regular expressions) */
static int term_103 (ZebraMaps zebra_maps, int reg_type, const char **src,
char *dst, int *errors, int space_split,
char *dst_term)
return i;
}
+/* term_103: handle term, where trunc=re-1 (regular expressions) */
static int term_102 (ZebraMaps zebra_maps, int reg_type, const char **src,
char *dst, int space_split, char *dst_term)
{
more = (int *) xmalloc (sizeof(*more)*rset_no);
buf = (struct it_key **) xmalloc (sizeof(*buf)*rset_no);
+ *prox_term = '\0';
for (i = 0; i<rset_no; i++)
{
int j;
- buf[i] = (struct it_key *) xmalloc (sizeof(**buf));
- rsfd[i] = rset_open (rset[i], RSETF_READ);
- if (!(more[i] = rset_read (rset[i], rsfd[i], buf[i], &term_index)))
- break;
for (j = 0; j<rset[i]->no_rset_terms; j++)
{
const char *nflags = rset[i]->rset_terms[j]->flags;
char *term = rset[i]->rset_terms[j]->name;
int lterm = strlen(term);
- if (length_prox_term)
- prox_term[length_prox_term++] = ' ';
- strcpy (prox_term + length_prox_term, term);
- length_prox_term += lterm;
+ if (lterm + length_prox_term < sizeof(prox_term)-1)
+ {
+ if (length_prox_term)
+ prox_term[length_prox_term++] = ' ';
+ strcpy (prox_term + length_prox_term, term);
+ length_prox_term += lterm;
+ }
if (min_nn > rset[i]->rset_terms[j]->nn)
min_nn = rset[i]->rset_terms[j]->nn;
flags = nflags;
}
}
+ for (i = 0; i<rset_no; i++)
+ {
+ buf[i] = (struct it_key *) xmalloc (sizeof(**buf));
+ rsfd[i] = rset_open (rset[i], RSETF_READ);
+ if (!(more[i] = rset_read (rset[i], rsfd[i], buf[i], &term_index)))
+ break;
+ }
if (i != rset_no)
{
rset_null_parms parms;
xfree (buf[i]);
--i;
}
- parms.rset_term = rset_term_create (prox_term, -1, flags);
+ parms.rset_term = rset_term_create (prox_term, length_prox_term,
+ flags);
parms.rset_term->nn = 0;
result = rset_create (rset_kind_null, &parms);
}
rset_temp_parms parms;
RSFD rsfd_result;
- parms.rset_term = rset_term_create (prox_term, -1, flags);
+ parms.rset_term = rset_term_create (prox_term, length_prox_term,
+ flags);
parms.rset_term->nn = min_nn;
parms.key_size = sizeof (struct it_key);
parms.temp_path = res_get (zh->res, "setTmpDir");
len_prefix = strlen(scan_info->prefix);
if (memcmp (name, scan_info->prefix, len_prefix))
return 1;
- if (pos > 0)
- idx = scan_info->after - pos + scan_info->before;
+ if (pos > 0) idx = scan_info->after - pos + scan_info->before;
else
idx = - pos - 1;
scan_info->list[idx].term = (char *)