source: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/src/text/bool_tree.h@ 23508

Last change on this file since 23508 was 23508, checked in by sjm84, 13 years ago

Committing 64 bit changes into the branch

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/**************************************************************************
2 *
3 * bool_tree.h -- description
4 * Copyright (C) 1994 Authors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id: bool_tree.h 23508 2010-12-17 01:04:10Z sjm84 $
21 *
22 **************************************************************************/
23
24/*
25 $Log$
26 Revision 1.1 2003/02/20 21:18:23 mdewsnip
27 Addition of MG package for search and retrieval
28
29 Revision 1.1 1999/08/10 21:17:46 sjboddie
30 renamed mg-1.3d directory mg
31
32 Revision 1.2 1998/11/25 07:55:42 rjmcnab
33
34 Modified mg to that you can specify the stemmer you want
35 to use via a command line option. You specify it to
36 mg_passes during the build process. The number of the
37 stemmer that you used is stored within the inverted
38 dictionary header and the stemmed dictionary header so
39 the correct stemmer is used in later stages of building
40 and querying.
41
42 Revision 1.1 1998/11/17 09:34:31 rjmcnab
43 *** empty log message ***
44
45 * Revision 1.2 1995/03/14 05:15:25 tes
46 * Updated the boolean query optimiser to do different types of optimisation.
47 * A query environment variable "optimise_type" specifies which one is to be
48 * used. Type 1 is the new one which is faster than 2.
49 *
50 * Revision 1.2 1994/10/18 06:11:07 tes
51 * The boolean optimiser seems to be modifying the parse tree
52 * like it is supposed to.
53 * Paragraph ranking now works without any text files if required to.
54 *
55 * Revision 1.1 1994/10/12 01:15:35 tes
56 * Found bugs in the existing boolean query optimiser.
57 * So decided to rewrite it.
58 * I accidentally deleted query.bool.y, but I have replaced it
59 * with bool_parser.y (which I have forgotten to add here ! ;-(
60 *
61 */
62
63#ifndef BOOL_TREE_H
64#define BOOL_TREE_H
65
66#include "sysfuncs.h"
67#include "term_lists.h"
68
69typedef enum
70 {
71 N_term, N_and, N_or, N_diff, N_none, N_all,
72 N_not, N_or_terms
73 }
74N_Tag;
75
76typedef struct bool_tree_node
77 {
78 N_Tag tag;
79 struct bool_tree_node *sibling;
80 union
81 {
82 struct bool_tree_node *child;
83 int term_id;
84 }
85 fields;
86 int sum_ft; /* for or_terms nodes */
87 }
88bool_tree_node;
89
90
91#define BOOL_HAS_CHILD(n) (\
92 (n)->tag==N_and || \
93 (n)->tag==N_or || (n)->tag==N_or_terms || \
94 (n)->tag==N_not || (n)->tag==N_diff)
95#define BOOL_TAG(n) ((n)->tag)
96#define BOOL_SIBLING(n) ((n)->sibling)
97#define BOOL_TERM(n) ((n)->fields.term_id)
98#define BOOL_CHILD(n) ((n)->fields.child)
99#define BOOL_SUM_FT(n) ((n)->sum_ft)
100
101bool_tree_node *CreateBoolNode (N_Tag tag);
102bool_tree_node *CopyBoolTree (bool_tree_node * tree);
103bool_tree_node *CreateBoolTermNode (TermList ** tl, char *text, int Count, int word_num,
104 mg_u_long count, mg_u_long doc_count, mg_u_long invf_ptr,
105 mg_u_long invf_len, int stemmer_num);
106bool_tree_node *CreateBoolTreeNode (N_Tag tag,
107 bool_tree_node * left, bool_tree_node * right);
108void FreeBoolTree (bool_tree_node ** tree);
109void PrintBoolTree (bool_tree_node * tree, FILE * file);
110bool_tree_node *LastBoolSibling (bool_tree_node * tree);
111
112
113#endif
Note: See TracBrowser for help on using the repository browser.