First parts of index_rules system (ICU support).
[idzebra-moved-to-github.git] / include / index_rules.h
1 /* $Id: index_rules.h,v 1.1 2007-10-23 12:26:25 adam Exp $
2    Copyright (C) 1995-2007
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
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
10 version.
11
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
15 for more details.
16
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
20
21 */
22
23 /** 
24     \brief Definitions for Zebra's index rules system
25 */
26
27 #ifndef ZEBRA_INDEX_RULES_H
28 #define ZEBRA_INDEX_RULES_H
29
30 #include <yaz/yconfig.h>
31 #include <yaz/xmltypes.h>
32
33 YAZ_BEGIN_CDECL
34
35 typedef struct zebra_index_rules_s *zebra_index_rules_t;
36
37 /** \brief creates index rules handler/object from file
38     \param fname filename
39     \returns handle (NULL if unsuccessful)
40
41     Config file format:
42     \verbatim
43     <indexrules>
44       <indexrule id="*:w" position="1" alwaysmatches="1" firstinfield="1"
45         locale="en">
46         <!-- conversion rules for words -->
47       </indexrule>
48       <indexrule id="*:p" position="0" alwaysmatches="0" firstinfield="0"
49         locale="en">
50         <!-- conversion rules for phrase -->
51       </indexrule>
52       <indexrule id="*:s" sort="1" 
53         locale="en">
54         <!-- conversion rules for phrase -->
55       </indexrule>
56     </indexrules>
57    \endverbatim
58  */
59 zebra_index_rules_t zebra_index_rules_create(const char *fname);
60
61 /** \brief destroys index rules object
62     \param r handle
63  */
64 void zebra_index_rules_destroy(zebra_index_rules_t r);
65
66
67 /** \brief creates index rules handler/object from xml Doc
68     \param fname filename
69     \returns handle (NULL if unsuccessful)
70
71     Similar to zebra_index_rules_create
72 */
73 zebra_index_rules_t zebra_index_rules_create_doc(xmlDocPtr doc);
74
75
76 /** \brief lookup of indexrule
77     \param r rules
78     \param id id to search for
79     \returns pattern ID
80 */
81 const char *zebra_index_rule_lookup_str(zebra_index_rules_t r, const char *id);
82
83 YAZ_END_CDECL
84
85 #endif
86 /*
87  * Local variables:
88  * c-basic-offset: 4
89  * indent-tabs-mode: nil
90  * End:
91  * vim: shiftwidth=4 tabstop=8 expandtab
92  */
93