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

Revision 1907, 3.3 KB (checked in by kjm18, 19 years ago)

get_mg_type() added

  • 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  virtual text_t get_mg_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
81protected:
82
83  void setsearchmode (const queryparamclass &queryparams);
84  void submitquery (const queryparamclass &queryparams);
85  void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
86
87  virtual void filterquery (text_t &ttquerystring);
88};
89
90
91#endif
Note: See TracBrowser for help on using the browser.