if (wrbuf_len(facet_wrbuf))
{
- int i;
- for (i = 0; i < s->num_termlists; i++)
- if (!strcmp(s->termlists[i].name, type))
+ struct named_termlist **tp = &s->termlists;
+ for (; (*tp); tp = &(*tp)->next)
+ if (!strcmp((*tp)->name, type))
break;
- if (i == s->num_termlists)
+ if (!*tp)
{
- if (i == SESSION_MAX_TERMLISTS)
- {
- session_log(s, YLOG_FATAL, "Too many termlists");
- wrbuf_destroy(facet_wrbuf);
- wrbuf_destroy(display_wrbuf);
- return;
- }
-
- s->termlists[i].name = nmem_strdup(s->nmem, type);
- s->termlists[i].termlist = termlist_create(s->nmem);
- s->num_termlists = i + 1;
+ *tp = nmem_malloc(s->nmem, sizeof(**tp));
+ (*tp)->name = nmem_strdup(s->nmem, type);
+ (*tp)->termlist = termlist_create(s->nmem);
+ (*tp)->next = 0;
}
-
-#if 0
- session_log(s, YLOG_LOG, "Facets for %s: %s norm:%s (%d)", type, value, wrbuf_cstr(facet_wrbuf), count);
-#endif
- termlist_insert(s->termlists[i].termlist, wrbuf_cstr(display_wrbuf),
+ termlist_insert((*tp)->termlist, wrbuf_cstr(display_wrbuf),
wrbuf_cstr(facet_wrbuf), count);
}
wrbuf_destroy(facet_wrbuf);
nmem_total(se->nmem));
nmem_reset(se->nmem);
se->total_records = se->total_merged = 0;
- se->num_termlists = 0;
-
+ se->termlists = 0;
relevance_clear(se->relevance);
/* reset list of sorted results and clear to relevance search */
session->total_records = 0;
session->number_of_warnings_unknown_elements = 0;
session->number_of_warnings_unknown_metadata = 0;
- session->num_termlists = 0;
+ session->termlists = 0;
session->reclist = reclist_create(nmem);
session->clients_active = 0;
session->clients_cached = 0;
const char *tname;
int must_generate_empty = 1; /* bug 5350 */
- for (i = 0; i < se->num_termlists; i++)
+ struct named_termlist *t = se->termlists;
+ for (; t; t = t->next)
{
- tname = se->termlists[i].name;
+ tname = t->name;
if (!strcmp(names[j], tname) || !strcmp(names[j], "*"))
{
struct termlist_score **p = 0;
wrbuf_puts(c->wrbuf, "\">\n");
must_generate_empty = 0;
- p = termlist_highscore(se->termlists[i].termlist, &len,
- nmem_tmp);
+ p = termlist_highscore(t->termlist, &len, nmem_tmp);
if (p)
{
int i;
#define SESSION_WATCH_BYTARGET 4
#define SESSION_WATCH_MAX 4
-#define SESSION_MAX_TERMLISTS 10
-
typedef void (*session_watchfun)(void *data);
struct named_termlist
{
char *name;
struct termlist *termlist;
+ struct named_termlist *next;
};
struct session_watchentry {
struct client_list *clients_cached; // Clients in cache
NMEM session_nmem; // Nmem for session-permanent storage
NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
- int num_termlists;
- struct named_termlist termlists[SESSION_MAX_TERMLISTS];
+ struct named_termlist *termlists;
struct relevance *relevance;
struct reclist *reclist;
char *mergekey;