X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fattribute.c;h=b9079cd5bd00f51183404727a787624342a6b26b;hb=3fe5d30485d3fc95b24ee5e7dc75971447ecb5aa;hp=cb9d62c060c86362d32ed1af3fa630ebd8974f0d;hpb=6684933a7dbf61609c4c4a1db1ebb8d80169ad05;p=idzebra-moved-to-github.git diff --git a/index/attribute.c b/index/attribute.c index cb9d62c..b9079cd 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -1,4 +1,4 @@ -/* $Id: attribute.c,v 1.24 2006-06-22 15:07:20 adam Exp $ +/* $Id: attribute.c,v 1.27 2006-09-20 10:51:25 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include @@ -121,15 +121,38 @@ ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh, ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh, Z_AttributesPlusTerm *zapt, - zinfo_index_category_t cat, int index_type, const char *xpath_use, oid_value curAttributeSet, int *ord) { + ZEBRA_RES res = ZEBRA_OK; + AttrType relation; + int relation_value; + zinfo_index_category_t cat = zinfo_index_category_index; + + attr_init_APT(&relation, zapt, 2); + relation_value = attr_find(&relation, NULL); + + if (relation_value == 103) /* always matches */ + cat = zinfo_index_category_alwaysmatches; + if (!xpath_use) - return zebra_attr_list_get_ord(zh, zapt->attributes, - cat, index_type, curAttributeSet, ord); + { + res = zebra_attr_list_get_ord(zh, zapt->attributes, + cat, index_type, + curAttributeSet, ord); + /* use attribute not found. But it the relation is + always matches and the regulare index attribute is found + return a different diagnostic */ + if (res != ZEBRA_OK && + relation_value == 103 + && zebra_attr_list_get_ord( + zh, zapt->attributes, + zinfo_index_category_index, index_type, + curAttributeSet, ord) == ZEBRA_OK) + zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_RELATION_ATTRIBUTE, 103); + } else { *ord = zebraExplain_lookup_attr_str(zh->reg->zei, cat, index_type, @@ -139,15 +162,16 @@ ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh, yaz_log(YLOG_LOG, "zebra_apt_get_ord FAILED xpath=%s index_type=%c", xpath_use, index_type); zebra_setError(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, 0); - return ZEBRA_FAIL; + res = ZEBRA_FAIL; } else { yaz_log(YLOG_LOG, "zebra_apt_get_ord OK xpath=%s index_type=%c", xpath_use, index_type); + } - return ZEBRA_OK; } + return res; } ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh, @@ -166,11 +190,7 @@ ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh, if (zebra_attr_list_get_ord(zh, sortAttributes->list, zinfo_index_category_sort, - 's', VAL_BIB1, ord)== ZEBRA_OK) - return ZEBRA_OK; - if (zebra_attr_list_get_ord(zh, sortAttributes->list, - zinfo_index_category_sort, - 'S', VAL_BIB1, ord)== ZEBRA_OK) + -1 /* any index */, VAL_BIB1, ord)== ZEBRA_OK) return ZEBRA_OK; return ZEBRA_FAIL; }