Local no (sysno) and score is transferred to retrieveCtrl.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recctrl.h,v $
- * Revision 1.8 1995-10-02 15:43:35 adam
+ * Revision 1.9 1995-10-06 14:37:53 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.8 1995/10/02 15:43:35 adam
* Extract uses file descriptors instead of FILE pointers.
*
* Revision 1.7 1995/10/02 15:18:09 adam
int fd; /* File descriptor and read function */
int (*readf)(int fd, char *buf, size_t count);
oid_value input_format; /* Preferred record syntax */
+ int localno; /* local id of record */
+ int score; /* score 0-1000 or -1 if none */
/* response */
oid_value output_format;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rset.h,v $
- * Revision 1.7 1995-09-07 13:58:08 adam
+ * Revision 1.8 1995-10-06 14:37:53 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.7 1995/09/07 13:58:08 adam
* New parameter: result-set file descriptor (RSFD) to support multiple
* positions within the same result-set.
* Boolean operators: and, or, not implemented.
int (*f_count)(struct rset_control *ct);
int (*f_read)(RSFD rfd, void *buf);
int (*f_write)(RSFD rfd, const void *buf);
+ int (*f_score)(RSFD rfd, int *score);
} rset_control;
typedef struct rset
/* int rset_write(RSET rs, const void *buf); */
#define rset_write(rs, fd, buf) ((*(rs)->control->f_write)((fd), (buf)))
+/* int rset_score(RSET rs, int *buf); */
+#define rset_score(rs, fd, score) ((*(rs)->control->f_score)((fd), (score)))
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.12 1995-10-06 13:52:06 adam
+ * Revision 1.13 1995-10-06 14:38:00 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.12 1995/10/06 13:52:06 adam
* Bug fixes. Handler may abort further scanning.
*
* Revision 1.11 1995/10/06 10:43:57 adam
return read (fd, buf, count);
}
-static int record_fetch (ZServerInfo *zi, int sysno, ODR stream,
+static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream,
oid_value input_format, oid_value *output_format,
char **rec_bufp, int *rec_lenp)
{
logf (LOG_FATAL|LOG_ERRNO, "Retrieve: Open record file %s", fname);
exit (1);
}
+ logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score);
+ retrieveCtrl.localno = sysno;
+ retrieveCtrl.score = score;
retrieveCtrl.odr = stream;
retrieveCtrl.readf = record_read;
retrieveCtrl.input_format = retrieveCtrl.output_format = input_format;
logf (LOG_DEBUG, "Out of range. pos=%d", q->number);
return &r;
}
- r.errcode = record_fetch (&server_info, records[0].sysno, q->stream,
+ r.errcode = record_fetch (&server_info, records[0].sysno,
+ records[0].score, q->stream,
q->format, &r.format, &r.record, &r.len);
return &r;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.8 1995-10-06 13:52:06 adam
+ * Revision 1.9 1995-10-06 14:38:01 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.8 1995/10/06 13:52:06 adam
* Bug fixes. Handler may abort further scanning.
*
* Revision 1.7 1995/10/06 10:43:57 adam
typedef struct {
int sysno;
+ int score;
} ZServerSetSysno;
typedef struct ZServerSet_ {
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zsets.c,v $
- * Revision 1.6 1995-09-28 09:19:49 adam
+ * Revision 1.7 1995-10-06 14:38:01 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.6 1995/09/28 09:19:49 adam
* xfree/xmalloc used everywhere.
* Extract/retrieve method seems to work for text records.
*
if (position == positions[num_i])
{
sr[num_i].sysno = psysno;
+ rset_score (rset, rfd, &sr[num_i].score);
num_i++;
if (++num_i == num)
break;
xfree (records[i].buf);
xfree (records);
}
-
-
-#if 0
-ZServerSetSysno *resultSetSysno (ZServerInfo *zi, const char *name,
- int num, int *positions)
-{
- ZServerSet *sset;
- ZServerRecord *sr;
- RSET rset;
- int num_i = 0;
- int position = 0;
- int psysno = 0;
- struct it_key key;
- RSFD rfd;
-
- if (!(sset = resultSetGet (zi, name)))
- return NULL;
- if (!(rset = sset->rset))
- return NULL;
- logf (LOG_DEBUG, "resultSetRecordGet");
- sr = xmalloc (sizeof(*sr) * num);
- rfd = rset_open (rset, 0);
- while (rset_read (rset, rfd, &key))
- {
- if (key.sysno != psysno)
- {
- psysno = key.sysno;
- position++;
- if (position == positions[num_i])
- {
- FILE *inf;
- char fname[SYS_IDX_ENTRY_LEN];
-
- sr[num_i].buf = NULL;
- if (lseek (zi->sys_idx_fd, psysno * SYS_IDX_ENTRY_LEN,
- SEEK_SET) == -1)
- {
- logf (LOG_FATAL|LOG_ERRNO, "lseek of sys_idx");
- exit (1);
- }
- if (read (zi->sys_idx_fd, fname, SYS_IDX_ENTRY_LEN) == -1)
- {
- logf (LOG_FATAL|LOG_ERRNO, "read of sys_idx");
- exit (1);
- }
- if (!(inf = fopen (fname, "r")))
- logf (LOG_WARN, "fopen: %s", fname);
- else
- {
- long size;
-
- fseek (inf, 0L, SEEK_END);
- size = ftell (inf);
- fseek (inf, 0L, SEEK_SET);
- logf (LOG_DEBUG, "get sysno=%d, fname=%s, size=%ld",
- psysno, fname, (long) size);
- sr[num_i].buf = xmalloc (size+1);
- sr[num_i].size = size;
- sr[num_i].buf[size] = '\0';
- if (fread (sr[num_i].buf, size, 1, inf) != 1)
- {
- logf (LOG_FATAL|LOG_ERRNO, "fread %s", fname);
- exit (1);
- }
- fclose (inf);
- }
- num_i++;
- if (num_i == num)
- break;
- }
- }
- }
- rset_close (rset, rfd);
- while (num_i < num)
- {
- sr[num_i].buf = NULL;
- sr[num_i].size = 0;
- num_i++;
- }
- return sr;
-}
-#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsbool.c,v $
- * Revision 1.5 1995-09-08 14:52:41 adam
+ * Revision 1.6 1995-10-06 14:38:05 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.5 1995/09/08 14:52:41 adam
* Work on relevance feedback.
*
* Revision 1.4 1995/09/08 08:54:04 adam
static int r_read_or (RSFD rfd, void *buf);
static int r_read_not (RSFD rfd, void *buf);
static int r_write (RSFD rfd, const void *buf);
+static int r_score (RSFD rfd, int *score);
static const rset_control control_and =
{
r_rewind,
r_count,
r_read_and,
- r_write
+ r_write,
+ r_score
};
static const rset_control control_or =
r_rewind,
r_count,
r_read_or,
- r_write
+ r_write,
+ r_score
};
static const rset_control control_not =
r_rewind,
r_count,
r_read_not,
- r_write
+ r_write,
+ r_score
};
logf (LOG_FATAL, "bool set type is read-only");
return -1;
}
+
+static int r_score (RSFD rfd, int *score)
+{
+ *score = -1;
+ return -1;
+}
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsisam.c,v $
- * Revision 1.10 1995-09-08 14:52:42 adam
+ * Revision 1.11 1995-10-06 14:38:05 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.10 1995/09/08 14:52:42 adam
* Work on relevance feedback.
*
* Revision 1.9 1995/09/07 13:58:43 adam
static int r_count (rset_control *ct);
static int r_read (RSFD rfd, void *buf);
static int r_write (RSFD rfd, const void *buf);
+static int r_score (RSFD rfd, int *score);
static const rset_control control =
{
r_rewind,
r_count,
r_read,
- r_write
+ r_write,
+ r_score
};
const rset_control *rset_kind_isam = &control;
logf (LOG_FATAL, "ISAM set type is read-only");
return -1;
}
+
+static int r_score (RSFD rfd, int *score)
+{
+ *score = -1;
+ return -1;
+}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsnull.c,v $
- * Revision 1.3 1995-09-08 14:52:42 adam
+ * Revision 1.4 1995-10-06 14:38:06 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.3 1995/09/08 14:52:42 adam
* Work on relevance feedback.
*
* Revision 1.2 1995/09/07 13:58:43 adam
static int r_count (rset_control *ct);
static int r_read (RSFD rfd, void *buf);
static int r_write (RSFD rfd, const void *buf);
+static int r_score (RSFD rfd, int *score);
static const rset_control control =
{
r_rewind,
r_count,
r_read,
- r_write
+ r_write,
+ r_score
};
const rset_control *rset_kind_null = &control;
logf (LOG_FATAL, "NULL set type is read-only");
return -1;
}
+
+static int r_score (RSFD rfd, int *score)
+{
+ *score = -1;
+ return -1;
+}
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsrel.c,v $
- * Revision 1.4 1995-09-14 07:48:56 adam
+ * Revision 1.5 1995-10-06 14:38:06 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.4 1995/09/14 07:48:56 adam
* Other score calculation.
*
* Revision 1.3 1995/09/11 15:23:40 adam
static int r_count (rset_control *ct);
static int r_read (RSFD rfd, void *buf);
static int r_write (RSFD rfd, const void *buf);
+static int r_score (RSFD rfd, int *score);
static const rset_control control =
{
r_rewind,
r_count,
r_read,
- r_write
+ r_write,
+ r_score
};
const rset_control *rset_kind_relevance = &control;
if (p->position <= 0)
return 0;
--(p->position);
- logf (LOG_DEBUG, "score: %f",
- info->score_buf[info->sort_idx[p->position]]);
memcpy ((char*) buf,
info->key_buf + info->key_size * info->sort_idx[p->position],
info->key_size);
return 1;
}
+static int r_score (RSFD rfd, int *score)
+{
+ struct rset_rel_rfd *p = rfd;
+ struct rset_rel_info *info = p->info;
+
+ if (p->position < 0)
+ return 0;
+ *score = (int) (1000*info->score_buf[info->sort_idx[p->position]]);
+ return 1;
+}
+
static int r_write (RSFD rfd, const void *buf)
{
logf (LOG_FATAL, "relevance set type is read-only");
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rstemp.c,v $
- * Revision 1.12 1995-09-28 09:52:11 adam
+ * Revision 1.13 1995-10-06 14:38:06 adam
+ * New result set method: r_score.
+ * Local no (sysno) and score is transferred to retrieveCtrl.
+ *
+ * Revision 1.12 1995/09/28 09:52:11 adam
* xfree/xmalloc used everywhere.
*
* Revision 1.11 1995/09/18 14:17:56 adam
static int r_count (rset_control *ct);
static int r_read (RSFD rfd, void *buf);
static int r_write (RSFD rfd, const void *buf);
+static int r_score (RSFD rfd, int *score);
static const rset_control control =
{
r_rewind,
r_count,
r_read,
- r_write
+ r_write,
+ r_score
};
const rset_control *rset_kind_temp = &control;
return 1;
}
+static int r_score (RSFD rfd, int *score)
+{
+ *score = -1;
+ return -1;
+}