+
+static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm)
+{
+ if (ct->term)
+ rset_get_one_term(ct, terms, maxterms, curterm);
+ else
+ {
+ /* Special case: Some multi-ors have all terms pointing to the same
+ term. We do not want to duplicate those. Other multiors (and ands)
+ have different terms under them. Those we want.
+ */
+ int firstterm= *curterm;
+ int i;
+
+ for (i = 0; i<ct->no_children; i++)
+ {
+ rset_getterms(ct->children[i], terms, maxterms, curterm);
+ if ( ( *curterm > firstterm+1 ) &&
+ ( *curterm <= maxterms ) &&
+ ( terms[(*curterm)-1] == terms[firstterm] )
+ )
+ (*curterm)--; /* forget the term, seen that before */
+ }
+ }
+}
+
+