1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * search.cpp -- abstract search class for mg
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | * $Id: search.cpp 1324 2000-08-02 00:58:29Z kjm18 $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.1 2000/08/02 00:58:29 kjm18
|
---|
31 | mgpp incorporated. the old mgsearchclass and queryfilterclass are changed.
|
---|
32 | Have a base searchclass, from which mgsearchclass and mgppsearchclass inherit.
|
---|
33 | Have a base queryfilterclass, from which mgqueryfilterclass and
|
---|
34 | mgppqueryfilterclass inherit. librarymain in recpt should choose the appropriate
|
---|
35 | type (mg vs mgpp) for each collection.
|
---|
36 |
|
---|
37 | Revision 1.22 1999/09/24 02:41:21 rjmcnab
|
---|
38 | change to use has_unicode_letdig in text_t
|
---|
39 |
|
---|
40 | Revision 1.21 1999/09/21 21:41:41 sjboddie
|
---|
41 | fixed an error in what I committed last
|
---|
42 |
|
---|
43 | Revision 1.20 1999/09/21 11:59:26 sjboddie
|
---|
44 | added Maxdocs queryfilter option (which may be -1 for 'all)
|
---|
45 |
|
---|
46 | Revision 1.19 1999/09/07 22:52:52 rjmcnab
|
---|
47 | Seems to be an error in mg for retrieving documents using a paragraph
|
---|
48 | based index for some cases. Just added a work around (loads the default
|
---|
49 | index every time).
|
---|
50 |
|
---|
51 | Revision 1.18 1999/09/07 04:57:22 sjboddie
|
---|
52 | added gpl notice
|
---|
53 |
|
---|
54 | Revision 1.17 1999/08/31 22:42:41 rjmcnab
|
---|
55 | A couple of minor things.
|
---|
56 |
|
---|
57 | Revision 1.16 1999/08/25 04:51:06 sjboddie
|
---|
58 | small change to allow for searching using boolean operators
|
---|
59 |
|
---|
60 | Revision 1.15 1999/07/16 08:35:03 rjmcnab
|
---|
61 | Fixed a weird bug to do with a faulty case statement.
|
---|
62 |
|
---|
63 | Revision 1.14 1999/07/16 03:42:22 sjboddie
|
---|
64 | changed isApprox
|
---|
65 |
|
---|
66 | Revision 1.13 1999/07/16 00:12:46 sjboddie
|
---|
67 | removed all the old post-processing stuff
|
---|
68 |
|
---|
69 | Revision 1.12 1999/07/07 06:17:47 rjmcnab
|
---|
70 | broke search_index into index+subcollection+language
|
---|
71 | within mgsearch
|
---|
72 |
|
---|
73 | Revision 1.11 1999/07/05 21:06:43 rjmcnab
|
---|
74 | Disabled quoted strings.
|
---|
75 |
|
---|
76 | Revision 1.10 1999/07/01 09:29:19 rjmcnab
|
---|
77 | Changes for better reporting of number documents which match a query. Changes
|
---|
78 | should still work as before with older versions of mg.
|
---|
79 |
|
---|
80 | Revision 1.9 1999/07/01 03:54:48 rjmcnab
|
---|
81 | Added code to plug in the equivalent terms of each of the query terms.
|
---|
82 | Also added a function to get a raw utf8 encoded mg document (for speeding
|
---|
83 | up a phrase matching function)
|
---|
84 |
|
---|
85 | Revision 1.8 1999/06/30 04:04:12 rjmcnab
|
---|
86 | made stemming functions available from mgsearch and made the stems
|
---|
87 | for the query terms available in queryinfo
|
---|
88 |
|
---|
89 | Revision 1.7 1999/06/27 22:07:27 sjboddie
|
---|
90 | got rid of all the old functions for dealing with dir indexes
|
---|
91 |
|
---|
92 | Revision 1.6 1999/06/09 00:41:32 sjboddie
|
---|
93 | phrase searching now uses case-folding if it's turned on
|
---|
94 |
|
---|
95 | Revision 1.5 1999/02/21 22:31:35 rjmcnab
|
---|
96 |
|
---|
97 | Removed locateinfo.
|
---|
98 |
|
---|
99 | Revision 1.4 1999/02/03 01:13:27 sjboddie
|
---|
100 |
|
---|
101 | Got interface to handle subcollections and language subcollections -
|
---|
102 | committed changes made to some of the collections
|
---|
103 |
|
---|
104 | Revision 1.3 1999/01/19 01:38:17 rjmcnab
|
---|
105 |
|
---|
106 | Made the source more portable.
|
---|
107 |
|
---|
108 | Revision 1.2 1999/01/12 01:51:02 rjmcnab
|
---|
109 |
|
---|
110 | Standard header.
|
---|
111 |
|
---|
112 | Revision 1.1 1999/01/08 09:02:16 rjmcnab
|
---|
113 |
|
---|
114 | Moved from src/library.
|
---|
115 |
|
---|
116 | */
|
---|
117 |
|
---|
118 | #include "search.h"
|
---|
119 |
|
---|
120 | ////////////////////
|
---|
121 | // search class //
|
---|
122 | ////////////////////
|
---|
123 |
|
---|
124 | searchclass::searchclass ()
|
---|
125 | {
|
---|
126 | cache = new querycache (RESULTCACHESIZE);
|
---|
127 |
|
---|
128 | }
|
---|
129 |
|
---|
130 | searchclass::~searchclass ()
|
---|
131 | {
|
---|
132 | if (cache != NULL)
|
---|
133 | {
|
---|
134 | delete cache;
|
---|
135 | cache = NULL;
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 |
|
---|
140 | void searchclass::setcollectdir (const text_t &thecollectdir)
|
---|
141 | {
|
---|
142 | collectdir = thecollectdir;
|
---|
143 | }
|
---|
144 |
|
---|
145 |
|
---|