-/* $Id: zebramap.c,v 1.57 2007-03-19 21:50:39 adam Exp $
+/* $Id: zebramap.c,v 1.59 2007-10-29 16:57:54 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
}
int zebra_maps_attr(ZebraMaps zms, Z_AttributesPlusTerm *zapt,
- unsigned *reg_id, char **search_type, char *rank_type,
+ const char **index_type, char **search_type, char *rank_type,
int *complete_flag, int *sort_flag)
{
AttrType completeness;
AttrType use;
int completeness_value;
int structure_value;
+ const char *structure_str = 0;
int relation_value;
int sort_relation_value;
int weight_value;
attr_init_APT(&use, zapt, 1);
completeness_value = attr_find(&completeness, NULL);
- structure_value = attr_find(&structure, NULL);
+ structure_value = attr_find_ex(&structure, NULL, &structure_str);
relation_value = attr_find(&relation, NULL);
sort_relation_value = attr_find(&sort_relation, NULL);
weight_value = attr_find(&weight, NULL);
*complete_flag = 1;
else
*complete_flag = 0;
- *reg_id = 0;
+ *index_type = 0;
*sort_flag =(sort_relation_value > 0) ? 1 : 0;
*search_type = "phrase";
sprintf(rank_type, "rank,w=%d,u=%d", weight_value, use_value);
}
if (*complete_flag)
- *reg_id = 'p';
+ *index_type = "p";
else
- *reg_id = 'w';
+ *index_type = "w";
switch (structure_value)
{
case 6: /* word list */
break;
case 107: /* local-number */
*search_type = "local";
- *reg_id = 0;
+ *index_type = 0;
break;
case 109: /* numeric string */
- *reg_id = 'n';
+ *index_type = "n";
*search_type = "numeric";
break;
case 104: /* urx */
- *reg_id = 'u';
+ *index_type = "u";
*search_type = "phrase";
break;
case 3: /* key */
- *reg_id = '0';
+ *index_type = "0";
*search_type = "phrase";
break;
case 4: /* year */
- *reg_id = 'y';
+ *index_type = "y";
*search_type = "phrase";
break;
case 5: /* date */
- *reg_id = 'd';
+ *index_type = "d";
*search_type = "phrase";
break;
+ case -2:
+ if (structure_str && *structure_str)
+ *index_type = structure_str;
+ else
+ return -1;
+ break;
default:
return -1;
}