source: trunk/gsdl/src/colservr/mgsearch.h@ 8024

Last change on this file since 8024 was 8024, checked in by davidb, 20 years ago

Renaming of variables and member functions using contstructs such as
'mgsearchptr' and the like to 'textsearchptr' to better reflect what
the item represents.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/**********************************************************************
2 *
3 * mgsearch.h -- implementation of search for old versions of 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 *********************************************************************/
25
26
27#ifndef MGSEARCH_H
28#define MGSEARCH_H
29
30
31#include "search.h"
32
33class mgsearchclass : public searchclass {
34public:
35 mgsearchclass ();
36 virtual ~mgsearchclass ();
37
38 virtual text_t get_textindex_type() {return "mg";}
39
40 // you only need to use this function before doing any stemming
41 // casefolding and stemming will be set if values for them are
42 // provided (0 or 1).
43 // makeindexcurrent returns true if it was able to load the database
44 bool makeindexcurrent (const text_t &index, const text_t &subcollection,
45 const text_t &language, const text_t &collection,
46 int casefolding = -1, int stemming = -1);
47
48 // stem word uses the values set in the last call to makeindexcurrent
49 // to stem the word. It is assumed that word is in unicode
50 text_t stemword (const text_t &word);
51 text_t stemword (text_t::const_iterator here, text_t::const_iterator end);
52
53 // the search results are returned in queryresults
54 // search returns 'true' if it was able to do a search
55 bool search(const queryparamclass &queryparams,
56 queryresultsclass &queryresults);
57
58 // the document text for 'docnum' is placed in 'output'
59 // docTargetDocument returns 'true' if it was able to
60 // try to get a document
61 // collection is needed to see if an index from the
62 // collection is loaded. If no index has been loaded
63 // defaultindex is needed to load one
64 bool docTargetDocument(const text_t &defaultindex,
65 const text_t &defaultsubcollection,
66 const text_t &defaultlanguage,
67 const text_t &collection,
68 int docnum,
69 text_t &output);
70
71 // same as docTargetDocument except the document is returned
72 // in its raw form. UDoc remains the property of mg and may
73 // be destroyed on the next call to mg.
74 bool mgdocument (const text_t &defaultindex,
75 const text_t &defaultsubcollection,
76 const text_t &defaultlanguage,
77 const text_t &collection,
78 int docnum,
79 char *&UDoc, int &ULen);
80
81 // unload_database simply calls mgq's close_all_databases function to
82 // clear any cached databases - this is useful when attempting to
83 // completely remove all trace of a collectionserver at runtime (when
84 // using a persistent version of Greenstone like the windows local
85 // library)
86 void unload_database ();
87
88
89protected:
90
91 void setsearchmode (const queryparamclass &queryparams);
92 void submitquery (const queryparamclass &queryparams);
93 void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
94
95 virtual void filterquery (text_t &ttquerystring);
96};
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.