+void pp2_relevance_first(pp2_relevance_token_t prt,
+ const char *buf,
+ int skip_article)
+{
+ if (skip_article)
+ {
+ const char *p = buf;
+ char firstword[64];
+ char *pout = firstword;
+ char articles[] = "the den der die des an a "; // must end in space
+
+ while (*p && !isalnum(*(unsigned char *)p))
+ p++;
+ for (; *p && *p != ' ' && pout - firstword < (sizeof(firstword)-2); p++)
+ *pout++ = tolower(*(unsigned char *)p);
+ *pout++ = ' ';
+ *pout++ = '\0';
+ if (strstr(articles, firstword))
+ buf = p;
+ }
+
+ wrbuf_rewind(prt->norm_str);
+ wrbuf_rewind(prt->sort_str);
+ prt->cp = buf;
+ prt->last_cp = 0;
+
+#if YAZ_HAVE_ICU
+ if (prt->iter)
+ {
+ icu_iter_first(prt->iter, buf);
+ }
+#endif // YAZ_HAVE_ICU
+}