Display match string if log level "extract" is used.
[idzebra-moved-to-github.git] / index / attribute.c
index 59ae622..4272aab 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: attribute.c,v 1.25 2006-06-23 11:21:38 adam Exp $
-   Copyright (C) 1995-2006
+/* $Id: attribute.c,v 1.31 2007-05-08 12:50:04 adam Exp $
+   Copyright (C) 1995-2007
    Index Data ApS
 
 This file is part of the Zebra server.
@@ -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 <stdio.h>
@@ -28,6 +28,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <idzebra/util.h>
 #include <attrfind.h>
 #include "index.h"
+#include <yaz/oid_db.h>
 
 static data1_att *getatt(data1_attset *p, int att)
 {
@@ -45,7 +46,7 @@ static data1_att *getatt(data1_attset *p, int att)
     return 0;
 }
 
-static int att_getentbyatt(ZebraHandle zi, oid_value set, int att,
+static int att_getentbyatt(ZebraHandle zi, const Odr_oid *set, int att,
                            const char **name)
 {
     data1_att *r;
@@ -69,7 +70,7 @@ ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
                                   int index_type,
-                                  oid_value curAttributeSet,
+                                  const Odr_oid *curAttributeSet,
                                   int *ord)
 {
     int use_value = -1;
@@ -123,7 +124,7 @@ ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh,
                             Z_AttributesPlusTerm *zapt,
                             int index_type,
                             const char *xpath_use,
-                            oid_value curAttributeSet,
+                            const Odr_oid *curAttributeSet,
                             int *ord)
 {
     ZEBRA_RES res = ZEBRA_OK;
@@ -181,20 +182,18 @@ ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
 {
     AttrType structure;
     int structure_value;
+
     attr_init_AttrList(&structure, sortAttributes->list, 4);
 
     *numerical = 0;
     structure_value = attr_find(&structure, 0);
     if (structure_value == 109)
         *numerical = 1;
-    
-    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)
+
+    if (zebra_attr_list_get_ord(
+            zh, sortAttributes->list,
+            zinfo_index_category_sort,
+            -1 /* any index */, yaz_oid_attset_bib_1, ord) == ZEBRA_OK)
         return ZEBRA_OK;
     return ZEBRA_FAIL;
 }