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

Last change on this file since 325 was 325, checked in by rjmcnab, 25 years ago

Added code to plug in the equivalent terms of each of the query terms.
Also added a function to get a raw utf8 encoded mg document (for speeding
up a phrase matching function)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 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 325 1999-07-01 03:54:49Z rjmcnab $
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 &collection,
38 int casefolding = -1, int stemming = -1);
39
40 // stem word uses the values set in the last call to makeindexcurrent
41 // to stem the word. It is assumed that word is in unicode
42 text_t stemword (const text_t &word);
43 text_t stemword (text_t::const_iterator here, text_t::const_iterator end);
44
45 // the search results are returned in queryresults
46 // search returns 'true' if it was able to do a search
47 bool search(const queryparamclass &queryparams,
48 queryresultsclass &queryresults);
49
50 // the document text for 'docnum' is placed in 'output'
51 // docTargetDocument returns 'true' if it was able to
52 // try to get a document
53 // collection is needed to see if an index from the
54 // collection is loaded. If no index has been loaded
55 // defaultindex is needed to load one
56 bool docTargetDocument(const text_t &defaultindex,
57 const text_t &collection,
58 int docnum,
59 text_t &output);
60
61 // same as docTargetDocument except the document is returned
62 // in its raw form. UDoc remains the property of mg and may
63 // be destroyed on the next call to mg.
64 bool mgdocument (const text_t &defaultindex,
65 const text_t &collection,
66 int docnum,
67 char *&UDoc, int &ULen);
68
69protected:
70 querycache *cache;
71 text_t collectdir; // the collection directory
72
73 void setsearchmode (const queryparamclass &queryparams);
74 void submitquery (const queryparamclass &queryparams);
75 void getresults (queryresultsclass &queryresults);
76
77 virtual void extractquoted (text_t &ttquerystring, text_t &ttquotedquery);
78 virtual void filterquery (text_t &ttquerystring);
79};
80
81
82#endif
Note: See TracBrowser for help on using the repository browser.