[110] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
[1324] | 3 | * mgsearch.h -- implementation of search for old versions of mg
|
---|
[110] | 4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 5 | *
|
---|
[534] | 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.
|
---|
[110] | 9 | *
|
---|
[534] | 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 | *
|
---|
[110] | 24 | *********************************************************************/
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | #ifndef MGSEARCH_H
|
---|
| 28 | #define MGSEARCH_H
|
---|
| 29 |
|
---|
| 30 |
|
---|
[1324] | 31 | #include "search.h"
|
---|
[110] | 32 |
|
---|
[1324] | 33 | class mgsearchclass : public searchclass {
|
---|
[110] | 34 | public:
|
---|
| 35 | mgsearchclass ();
|
---|
| 36 | virtual ~mgsearchclass ();
|
---|
[319] | 37 |
|
---|
[1907] | 38 | virtual text_t get_mg_type() {return "mg";}
|
---|
| 39 |
|
---|
[319] | 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
|
---|
[350] | 44 | bool makeindexcurrent (const text_t &index, const text_t &subcollection,
|
---|
| 45 | const text_t &language, const text_t &collection,
|
---|
[319] | 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);
|
---|
[325] | 51 | text_t stemword (text_t::const_iterator here, text_t::const_iterator end);
|
---|
[110] | 52 |
|
---|
| 53 | // the search results are returned in queryresults
|
---|
| 54 | // search returns 'true' if it was able to do a search
|
---|
[1324] | 55 | bool search(const queryparamclass &queryparams,
|
---|
[110] | 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
|
---|
[350] | 64 | bool docTargetDocument(const text_t &defaultindex,
|
---|
| 65 | const text_t &defaultsubcollection,
|
---|
| 66 | const text_t &defaultlanguage,
|
---|
[110] | 67 | const text_t &collection,
|
---|
| 68 | int docnum,
|
---|
| 69 | text_t &output);
|
---|
[325] | 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.
|
---|
[350] | 74 | bool mgdocument (const text_t &defaultindex,
|
---|
| 75 | const text_t &defaultsubcollection,
|
---|
| 76 | const text_t &defaultlanguage,
|
---|
[325] | 77 | const text_t &collection,
|
---|
| 78 | int docnum,
|
---|
| 79 | char *&UDoc, int &ULen);
|
---|
| 80 |
|
---|
[110] | 81 | protected:
|
---|
| 82 |
|
---|
| 83 | void setsearchmode (const queryparamclass &queryparams);
|
---|
| 84 | void submitquery (const queryparamclass &queryparams);
|
---|
[334] | 85 | void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
|
---|
[110] | 86 |
|
---|
| 87 | virtual void filterquery (text_t &ttquerystring);
|
---|
| 88 | };
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | #endif
|
---|