root/trunk/gsdl/src/colservr/mgsearch.h @ 1324

Revision 1324, 3.2 KB (checked in by kjm18, 19 years ago)

mgpp incorporated. the old mgsearchclass and queryfilterclass are changed.
Have a base searchclass, from which mgsearchclass and mgppsearchclass inherit.
Have a base queryfilterclass, from which mgqueryfilterclass and
mgppqueryfilterclass inherit. librarymain in recpt should choose the appropriate
type (mg vs mgpp) for each collection.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
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  // you only need to use this function before doing any stemming
39  // casefolding and stemming will be set if values for them are
40  // provided (0 or 1).
41  // makeindexcurrent returns true if it was able to load the database
42  bool makeindexcurrent (const text_t &index, const text_t &subcollection,
43             const text_t &language, const text_t &collection,
44             int casefolding = -1, int stemming = -1);
45
46  // stem word uses the values set in the last call to makeindexcurrent
47  // to stem the word. It is assumed that word is in unicode
48  text_t stemword (const text_t &word);
49  text_t stemword (text_t::const_iterator here, text_t::const_iterator end);
50 
51  // the search results are returned in queryresults
52  // search returns 'true' if it was able to do a search
53   bool search(const queryparamclass &queryparams,
54          queryresultsclass &queryresults);
55 
56  // the document text for 'docnum' is placed in 'output'
57  // docTargetDocument returns 'true' if it was able to
58  // try to get a document
59  // collection is needed to see if an index from the
60  // collection is loaded. If no index has been loaded
61  // defaultindex is needed to load one
62  bool docTargetDocument(const text_t &defaultindex,
63             const text_t &defaultsubcollection,
64             const text_t &defaultlanguage,
65             const text_t &collection,
66             int docnum,
67             text_t &output);
68
69  // same as docTargetDocument except the document is returned
70  // in its raw form. UDoc remains the property of mg and may
71  // be destroyed on the next call to mg.
72  bool mgdocument (const text_t &defaultindex,
73           const text_t &defaultsubcollection,
74           const text_t &defaultlanguage,
75           const text_t &collection,
76           int docnum,
77           char *&UDoc, int &ULen);
78
79protected:
80
81  void setsearchmode (const queryparamclass &queryparams);
82  void submitquery (const queryparamclass &queryparams);
83  void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
84
85  virtual void filterquery (text_t &ttquerystring);
86};
87
88
89#endif
Note: See TracBrowser for help on using the browser.