1 /* $Id: index_types.h,v 1.2 2007-10-25 19:25:00 adam Exp $
2 Copyright (C) 1995-2007
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \brief Definitions for Zebra's index types
28 #ifndef ZEBRA_INDEX_TYPES_H
29 #define ZEBRA_INDEX_TYPES_H
31 #include <yaz/yconfig.h>
32 #include <yaz/xmltypes.h>
36 /** \brief zebra index types handle (ptr) */
37 typedef struct zebra_index_types_s *zebra_index_types_t;
39 /** \brief zebra index type handle (ptr) */
40 typedef struct zebra_index_type_s *zebra_index_type_t;
42 /** \brief creates index types handler/object from file
44 \returns handle (NULL if unsuccessful)
49 <indextype id="*:w" position="1" alwaysmatches="1" firstinfield="1"
51 <!-- conversion rules for words -->
53 <indextype id="*:p" position="0" alwaysmatches="0" firstinfield="0"
55 <!-- conversion rules for phrase -->
57 <indextype id="*:s" sort="1"
59 <!-- conversion rules for phrase -->
64 zebra_index_types_t zebra_index_types_create(const char *fname);
66 /** \brief destroys index rules object
69 void zebra_index_types_destroy(zebra_index_types_t types);
72 /** \brief creates index types handler/object from xml Doc
73 \param doc Libxml2 document
74 \returns handle (NULL if unsuccessful)
76 Similar to zebra_index_types_create
78 zebra_index_types_t zebra_index_types_create_doc(xmlDocPtr doc);
81 /** \brief lookup of index type
83 \param id id to search for
86 const char *zebra_index_type_lookup_str(zebra_index_types_t types,
90 /** \brief get index type of a given ID
92 \param id ID to search for
93 \returns index type handle
95 zebra_index_type_t zebra_index_type_get(zebra_index_types_t types,
98 /** \brief check whether index type is of type 'index'
99 \param type index type
103 int zebra_index_type_is_index(zebra_index_type_t type);
105 /** \brief check whether index type is of type 'sort'
106 \param type index type
110 int zebra_index_type_is_sort(zebra_index_type_t type);
112 /** \brief check whether index type is of type 'staticrank'
113 \param type index type
117 int zebra_index_type_is_staticrank(zebra_index_type_t type);
120 /** \brief tokenize a term for an index type
121 \param type index type
122 \param buf term buffer (pass 0 to continue with previous buf)
123 \param len term length
124 \param result_buf resulting token buffer
125 \param result_len resulting token length
126 \retval 1 token read and result is in result_buf
127 \retval 0 no token read (no more tokens in buf)
129 int zebra_index_type_tokenize(zebra_index_type_t type,
130 const char *buf, size_t len,
131 const char **result_buf, size_t *result_len);
139 * indent-tabs-mode: nil
141 * vim: shiftwidth=4 tabstop=8 expandtab