source: trunk/gsdl/packages/mg/src/text/bool_tree.h@ 819

Last change on this file since 819 was 439, checked in by sjboddie, 25 years ago

renamed mg-1.3d directory mg

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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 439 1999-08-10 21:23:37Z sjboddie $
21 *
22 **************************************************************************/
23
24/*
25 $Log$
26 Revision 1.1 1999/08/10 21:17:46 sjboddie
27 renamed mg-1.3d directory mg
28
29 Revision 1.2 1998/11/25 07:55:42 rjmcnab
30
31 Modified mg to that you can specify the stemmer you want
32 to use via a command line option. You specify it to
33 mg_passes during the build process. The number of the
34 stemmer that you used is stored within the inverted
35 dictionary header and the stemmed dictionary header so
36 the correct stemmer is used in later stages of building
37 and querying.
38
39 Revision 1.1 1998/11/17 09:34:31 rjmcnab
40 *** empty log message ***
41
42 * Revision 1.2 1995/03/14 05:15:25 tes
43 * Updated the boolean query optimiser to do different types of optimisation.
44 * A query environment variable "optimise_type" specifies which one is to be
45 * used. Type 1 is the new one which is faster than 2.
46 *
47 * Revision 1.2 1994/10/18 06:11:07 tes
48 * The boolean optimiser seems to be modifying the parse tree
49 * like it is supposed to.
50 * Paragraph ranking now works without any text files if required to.
51 *
52 * Revision 1.1 1994/10/12 01:15:35 tes
53 * Found bugs in the existing boolean query optimiser.
54 * So decided to rewrite it.
55 * I accidentally deleted query.bool.y, but I have replaced it
56 * with bool_parser.y (which I have forgotten to add here ! ;-(
57 *
58 */
59
60#ifndef BOOL_TREE_H
61#define BOOL_TREE_H
62
63#include "sysfuncs.h"
64#include "term_lists.h"
65
66typedef enum
67 {
68 N_term, N_and, N_or, N_diff, N_none, N_all,
69 N_not, N_or_terms
70 }
71N_Tag;
72
73typedef struct bool_tree_node
74 {
75 N_Tag tag;
76 struct bool_tree_node *sibling;
77 union
78 {
79 struct bool_tree_node *child;
80 int term_id;
81 }
82 fields;
83 int sum_ft; /* for or_terms nodes */
84 }
85bool_tree_node;
86
87
88#define BOOL_HAS_CHILD(n) (\
89 (n)->tag==N_and || \
90 (n)->tag==N_or || (n)->tag==N_or_terms || \
91 (n)->tag==N_not || (n)->tag==N_diff)
92#define BOOL_TAG(n) ((n)->tag)
93#define BOOL_SIBLING(n) ((n)->sibling)
94#define BOOL_TERM(n) ((n)->fields.term_id)
95#define BOOL_CHILD(n) ((n)->fields.child)
96#define BOOL_SUM_FT(n) ((n)->sum_ft)
97
98bool_tree_node *CreateBoolNode (N_Tag tag);
99bool_tree_node *CopyBoolTree (bool_tree_node * tree);
100bool_tree_node *CreateBoolTermNode (TermList ** tl, char *text, int Count, int word_num,
101 u_long count, u_long doc_count, u_long invf_ptr,
102 u_long invf_len, int stemmer_num);
103bool_tree_node *CreateBoolTreeNode (N_Tag tag,
104 bool_tree_node * left, bool_tree_node * right);
105void FreeBoolTree (bool_tree_node ** tree);
106void PrintBoolTree (bool_tree_node * tree, FILE * file);
107bool_tree_node *LastBoolSibling (bool_tree_node * tree);
108
109
110#endif
Note: See TracBrowser for help on using the repository browser.