}
-static void add_facet(struct session *s, const char *type, const char *value)
+void add_facet(struct session *s, const char *type, const char *value, int count)
{
int i;
= termlist_create(s->nmem, TERMLIST_HIGH_SCORE);
s->num_termlists = i + 1;
}
- termlist_insert(s->termlists[i].termlist, value);
+ yaz_log(YLOG_DEBUG, "Session: facets for %s: %s (%d)", type, value, count);
+
+ termlist_insert(s->termlists[i].termlist, value, count);
}
static xmlDoc *record_to_xml(struct session_database *sdb, const char *rec)
\param cl client holds the result set for record
\param rec record buffer (0 terminated)
\param record_no record position (1, 2, ..)
+ \param nmem working NMEM
\retval 0 OK
\retval -1 failure
*/
(char *) value, ser_md->rank,
ser_md->name);
- // construct facets ...
- if (ser_md->termlist)
+ // construct facets ... unless the client already has reported them
+ if (ser_md->termlist && !client_has_facet(cl, (char *) type))
{
+
if (ser_md->type == Metadata_type_year)
{
char year[64];
sprintf(year, "%d", rec_md->data.number.max);
- add_facet(se, (char *) type, year);
+ add_facet(se, (char *) type, year, 1);
if (rec_md->data.number.max != rec_md->data.number.min)
{
sprintf(year, "%d", rec_md->data.number.min);
- add_facet(se, (char *) type, year);
+ add_facet(se, (char *) type, year, 1);
}
}
else
- add_facet(se, (char *) type, (char *) value);
+ add_facet(se, (char *) type, (char *) value, 1);
}
// cleaning up