source: main/trunk/greenstone2/runtime-src/src/colservr/mgsearch.h@ 21772

Last change on this file since 21772 was 9937, checked in by kjdon, 19 years ago

modified the filters/sources etc so that if an indexstem is specified in the build.cfg file, then this will be used as the root of the index/gdbm filenames instead of the collection name. colleciton name still used by default. this means that we can rename a coll directory without rebuilding.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 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 void set_indexstem(const text_t &indexstem);
89
90protected:
91
92 text_t indexstem; // the stem of the index files - defaults to the collectionname
93 void setsearchmode (const queryparamclass &queryparams);
94 void submitquery (const queryparamclass &queryparams);
95 void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
96 text_t getindexsuffix (const text_t &collection, const text_t &index);
97 virtual void filterquery (text_t &ttquerystring);
98};
99
100
101#endif
Note: See TracBrowser for help on using the repository browser.