+#if 1
+ attent *attp;
+ data1_local_attribute *local_attr;
+ int max_pos, prefix_len = 0;
+
+ attp = att_getentbyatt (curAttributeSet, use_value);
+ if (!attp)
+ {
+ zi->errCode = 114;
+ return -1;
+ }
+ if (zebTargetInfo_curDatabase (zi->zti, basenames[base_no]))
+ {
+ zi->errCode = 109; /* Database unavailable */
+ zi->errString = basenames[base_no];
+ }
+ for (local_attr = attp->local_attributes; local_attr;
+ local_attr = local_attr->next)
+ {
+ int ord;
+
+ ord = zebTargetInfo_lookupSU (zi->zti, attp->attset_ordinal,
+ local_attr->local);
+ if (ord < 0)
+ continue;
+ if (prefix_len)
+ term_dict[prefix_len++] = '|';
+ else
+ term_dict[prefix_len++] = '(';
+ if ((ord >= 'A' && ord <= 'Z') || (ord >= 'a' && ord <= 'z'))
+ term_dict[prefix_len++] = ord;
+ else
+ {
+ term_dict[prefix_len++] = '\\';
+ term_dict[prefix_len++] = ord;
+ }
+ }
+ if (!prefix_len)
+ {
+ zi->errCode = 114;
+ return -1;
+ }
+ term_dict[prefix_len++] = ')';
+ term_dict[prefix_len] = '\0';
+ if (!relational_term (zi, zapt, term_sub, term_dict,
+ attributeSet, grep_info, &max_pos))
+ {
+ const char *cp;
+
+ j = prefix_len;
+ switch (truncation_value)
+ {
+ case -1: /* not specified */
+ case 100: /* do not truncate */
+ term_dict[j++] = '(';
+ for (i = 0; term_sub[i]; i++)
+ verbatim_char (term_sub[i], &j, term_dict);
+ strcpy (term_dict+j, ")");
+ r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ &max_pos, 0, grep_handle);
+ if (r)
+ logf (LOG_WARN, "dict_lookup_grep err, trunc=none:%d", r);
+ break;
+ case 1: /* right truncation */
+ term_dict[j++] = '(';
+ for (i = 0; term_sub[i]; i++)
+ verbatim_char (term_sub[i], &j, term_dict);
+ strcpy (term_dict+j, ".*)");
+ dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ &max_pos, 0, grep_handle);
+ break;
+ case 2: /* left truncation */
+ case 3: /* left&right truncation */
+ zi->errCode = 120;
+ return -1;
+ case 101: /* process # in term */
+ term_dict[j++] = '(';
+ for (i=0; term_sub[i]; i++)
+ if (term_sub[i] == '#' && i > 2)
+ {
+ term_dict[j++] = '.';
+ term_dict[j++] = '*';
+ }
+ else
+ verbatim_char (term_sub[i], &j, term_dict);
+ strcpy (term_dict+j, ")");
+ r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ &max_pos, 0, grep_handle);
+ if (r)
+ logf (LOG_WARN, "dict_lookup_grep err, trunc=#: %d",
+ r);
+ break;
+ case 102: /* regular expression */
+ sprintf (term_dict + j, "(%s)", term_sub);
+ r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ &max_pos, 0, grep_handle);
+ if (r)
+ logf (LOG_WARN, "dict_lookup_grep err, trunc=regular: %d",
+ r);
+ break;
+ case 103: /* regular expression with error correction */
+ cp = term_sub;
+ r = 0;
+ if (*cp == '*' && cp[1] && cp[2])
+ {
+ r = atoi (cp+1);
+ cp += 2;
+ }
+ sprintf (term_dict + j, "(%s)", cp);
+ r = dict_lookup_grep (zi->wordDict, term_dict, r, grep_info,
+ &max_pos, j, grep_handle);
+ if (r)
+ logf (LOG_WARN, "dict_lookup_grep err, trunc=eregular: %d",
+ r);
+ break;
+ }
+ }
+#else