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