- int ok = 0;
- pct->icu_sts = U_ZERO_ERROR;
- ok = icu_chain_assign_cstr(pct->icu_chn, buf, &pct->icu_sts);
- //printf("\nfield ok: %d '%s'\n", ok, buf);
- prt->pct = pct;
+ 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);