+
+Rank weight can be controlled with attribute type 9. Default
+value is 34. Recommended values between 1-36.
+
--- 1.1 2001/10/25
Updated for YAZ version 1.8.
Added support for termsets - a result set of terms matching
-a given query.
+a given query. For @attr 8=<set> creates termset named <set>.
Added support for raw retrieval. Element Set Name R forces the
text filter which returns the record in its original form.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.h,v $
- * Revision 1.11 2001-01-22 10:42:56 adam
+ * Revision 1.12 2001-11-14 22:06:27 adam
+ * Rank-weight may be controlled via query.
+ *
+ * Revision 1.11 2001/01/22 10:42:56 adam
* Added numerical sort.
*
* Revision 1.10 1999/11/30 13:48:03 adam
const char *zebra_maps_output(ZebraMaps, unsigned reg_id, const char **from);
int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt,
- unsigned *reg_id, char **search_type, char **rank_type,
+ unsigned *reg_id, char **search_type, char *rank_type,
int *complete_flag, int *sort_flag);
int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes,
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rank1.c,v $
- * Revision 1.6 2000-03-15 15:00:30 adam
+ * Revision 1.7 2001-11-14 22:06:27 adam
+ * Rank-weight may be controlled via query.
+ *
+ * Revision 1.6 2000/03/15 15:00:30 adam
* First work on threaded version.
*
* Revision 1.5 1999/05/26 07:49:13 adam
int global_occur;
int global_inv;
int rank_flag;
+ int rank_weight;
};
struct rank_set_info {
for (i = 0; i < si->no_entries; i++)
{
int g = rset->rset_terms[i]->nn;
- if (!strcmp (rset->rset_terms[i]->flags, "rank"))
+ if (!strncmp (rset->rset_terms[i]->flags, "rank,", 5))
{
+ yaz_log (LOG_LOG, "%s", rset->rset_terms[i]->flags);
si->entries[i].rank_flag = 1;
+ si->entries[i].rank_weight = atoi (rset->rset_terms[i]->flags+5);
+ yaz_log (LOG_LOG, "i=%d weight=%d", i, si->entries[i].rank_weight);
(si->no_rank_entries)++;
}
else
return -1;
for (i = 0; i < si->no_entries; i++)
if (si->entries[i].rank_flag && (lo = si->entries[i].local_occur))
- score += (8+log2_int (lo)) * si->entries[i].global_inv;
- score *= 34;
+ score += (8+log2_int (lo)) * si->entries[i].global_inv *
+ si->entries[i].rank_weight;
divisor = si->no_rank_entries * (8+log2_int (si->last_pos/si->no_entries));
score = score / divisor;
+ yaz_log (LOG_LOG, "score=%d", score);
if (score > 1000)
score = 1000;
for (i = 0; i < si->no_entries; i++)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.107 2001-10-15 19:53:43 adam
+ * Revision 1.108 2001-11-14 22:06:27 adam
+ * Rank-weight may be controlled via query.
+ *
+ * Revision 1.107 2001/10/15 19:53:43 adam
* POSIX thread updates. First work on term sets.
*
* Revision 1.106 2001/04/11 07:58:13 adam
{
unsigned reg_id;
char *search_type = NULL;
- char *rank_type = NULL;
+ char rank_type[128];
int complete_flag;
int sort_flag;
char termz[IT_MAX_WORD+1];
zebra_maps_attr (zh->service->zebra_maps, zapt, ®_id, &search_type,
- &rank_type, &complete_flag, &sort_flag);
+ rank_type, &complete_flag, &sort_flag);
logf (LOG_DEBUG, "reg_id=%c", reg_id);
logf (LOG_DEBUG, "complete_flag=%d", complete_flag);
unsigned reg_id;
char *search_type = NULL;
- char *rank_type = NULL;
+ char rank_type[128];
int complete_flag;
int sort_flag;
*list = 0;
use_value = attr_find (&use, &attributeset);
if (zebra_maps_attr (zh->service->zebra_maps, zapt, ®_id, &search_type,
- &rank_type, &complete_flag, &sort_flag))
+ rank_type, &complete_flag, &sort_flag))
{
*num_entries = 0;
zh->errCode = 113;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.c,v $
- * Revision 1.21 2001-01-22 10:42:56 adam
+ * Revision 1.22 2001-11-14 22:06:27 adam
+ * Rank-weight may be controlled via query.
+ *
+ * Revision 1.21 2001/01/22 10:42:56 adam
* Added numerical sort.
*
* Revision 1.20 2000/03/02 14:35:19 adam
}
int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt,
- unsigned *reg_id, char **search_type, char **rank_type,
+ unsigned *reg_id, char **search_type, char *rank_type,
int *complete_flag, int *sort_flag)
{
AttrType completeness;
AttrType structure;
AttrType relation;
AttrType sort_relation;
+ AttrType weight;
int completeness_value;
int structure_value;
int relation_value;
int sort_relation_value;
+ int weight_value;
attr_init_APT (&structure, zapt, 4);
attr_init_APT (&completeness, zapt, 6);
attr_init_APT (&relation, zapt, 2);
attr_init_APT (&sort_relation, zapt, 7);
+ attr_init_APT (&weight, zapt, 9);
completeness_value = attr_find (&completeness, NULL);
structure_value = attr_find (&structure, NULL);
relation_value = attr_find (&relation, NULL);
sort_relation_value = attr_find (&sort_relation, NULL);
+ weight_value = attr_find (&weight, NULL);
if (completeness_value == 2 || completeness_value == 3)
*complete_flag = 1;
*sort_flag = (sort_relation_value > 0) ? 1 : 0;
*search_type = "phrase";
- *rank_type = "void";
+ strcpy (rank_type, "void");
if (relation_value == 102)
- *rank_type = "rank";
-
+ {
+ if (weight_value == -1)
+ weight_value == 34;
+ sprintf (rank_type, "rank,%d", weight_value);
+ }
if (*complete_flag)
*reg_id = 'p';
else