-#else
- int max_pos;
-#if 1
- attent *attp;
- data1_local_attribute *local_attr;
- int prefix_len;
-
- attp = att_getentbyatt (curAttributeSet, use_value);
- if (!attp)
- {
- zi->errCode = 114;
- return -1;
- }
- for (local_attr = attp->local_attributes; local_attr;
- local_attr = local_attr->next)
- {
- prefix_len = index_word_prefix (term_dict, attp->attset_ordinal,
- local_attr->local,
- basenames[base_no]);
-
- 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;
- }
- }
- if (max_pos <= strlen(basenames[base_no]))
- {
- zi->errCode = 109; /* Database unavailable */
- zi->errString = basenames[base_no];
- return -1;
- }
- }
-#else
- int prefix_len = index_word_prefix_map (term_dict, curAttributeSet,
- use_value,
- basenames[base_no]);
- if (prefix_len < 0)
- {
- zi->errCode = 114;
- return -1;
- }
- 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;
- }
- }
- if (max_pos <= strlen(basenames[base_no]))
- {
- zi->errCode = 109; /* Database unavailable */
- zi->errString = basenames[base_no];
- return -1;
- }
-#endif
-#endif