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

Last change on this file since 393 was 393, checked in by sjboddie, 25 years ago

removed all the old post-processing stuff

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/**********************************************************************
2 *
3 * mgsearch.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: mgsearch.h 393 1999-07-16 00:12:47Z sjboddie $
9 *
10 *********************************************************************/
11
12
13#ifndef MGSEARCH_H
14#define MGSEARCH_H
15
16
17#include "text_t.h"
18#include "querycache.h"
19
20#define RESULTCACHESIZE 10
21#define MAXNUMDOCS 500
22#define MAXNUMTERMS 100
23
24class mgsearchclass {
25public:
26 mgsearchclass ();
27 virtual ~mgsearchclass ();
28
29 // the index directory must be set before any searching
30 // is done
31 void setcollectdir (const text_t &thecollectdir);
32
33 // you only need to use this function before doing any stemming
34 // casefolding and stemming will be set if values for them are
35 // provided (0 or 1).
36 // makeindexcurrent returns true if it was able to load the database
37 bool makeindexcurrent (const text_t &index, const text_t &subcollection,
38 const text_t &language, const text_t &collection,
39 int casefolding = -1, int stemming = -1);
40
41 // stem word uses the values set in the last call to makeindexcurrent
42 // to stem the word. It is assumed that word is in unicode
43 text_t stemword (const text_t &word);
44 text_t stemword (text_t::const_iterator here, text_t::const_iterator end);
45
46 // the search results are returned in queryresults
47 // search returns 'true' if it was able to do a search
48 bool search(const queryparamclass &queryparams,
49 queryresultsclass &queryresults);
50
51 // the document text for 'docnum' is placed in 'output'
52 // docTargetDocument returns 'true' if it was able to
53 // try to get a document
54 // collection is needed to see if an index from the
55 // collection is loaded. If no index has been loaded
56 // defaultindex is needed to load one
57 bool docTargetDocument(const text_t &defaultindex,
58 const text_t &defaultsubcollection,
59 const text_t &defaultlanguage,
60 const text_t &collection,
61 int docnum,
62 text_t &output);
63
64 // same as docTargetDocument except the document is returned
65 // in its raw form. UDoc remains the property of mg and may
66 // be destroyed on the next call to mg.
67 bool mgdocument (const text_t &defaultindex,
68 const text_t &defaultsubcollection,
69 const text_t &defaultlanguage,
70 const text_t &collection,
71 int docnum,
72 char *&UDoc, int &ULen);
73
74protected:
75 querycache *cache;
76 text_t collectdir; // the collection directory
77
78 void setsearchmode (const queryparamclass &queryparams);
79 void submitquery (const queryparamclass &queryparams);
80 void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults);
81
82 virtual void filterquery (text_t &ttquerystring);
83};
84
85
86#endif
Note: See TracBrowser for help on using the repository browser.