+ *weight = atoi(cp + 1);
+ }
+ return entries;
+ }
+ }
+ return 0;
+}
+
+int relevance_snippet(struct relevance *r,
+ const char *words, const char *name,
+ WRBUF w_snippet)
+{
+ int no = 0;
+ const char *norm_str;
+ int highlight = 0;
+
+ pp2_charset_token_first(r->prt, words, 0);
+ while ((norm_str = pp2_charset_token_next(r->prt)))
+ {
+ size_t org_start, org_len;
+ struct word_entry *entries = r->entries;
+ int i;
+
+ pp2_get_org(r->prt, &org_start, &org_len);
+ for (; entries; entries = entries->next, i++)
+ {
+ if (*norm_str && !strcmp(norm_str, entries->norm_str))
+ {
+ break;
+ if (!highlight)
+ {
+ highlight = 1;
+ wrbuf_puts(w_snippet, "<match>");
+ }
+ break;
+ }
+ }
+ if (entries)
+ {
+ if (!highlight)
+ {
+ highlight = 1;
+ wrbuf_puts(w_snippet, "<match>");
+ no++;