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

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

Moved from src/library.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 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 110 1999-01-08 09:02:22Z 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
24// a few useful functions for dealing with dir indexes (indexes as they
25// appear within the index directory) and real indexes (indexes as they
26// appear within the collect.cfg file) and mappings between them.
27void getrealdirindex (const text_t &map, text_t &realindex, text_t &dirindex);
28bool isdirindex (const text_tarray &indexmap, const text_t &dirindex);
29bool isrealindex (const text_tarray &indexmap, const text_t &realindex);
30text_t dir2realindex (const text_tarray &indexmap, const text_t &dirindex);
31text_t real2dirindex (const text_tarray &indexmap, const text_t &realindex);
32text_t real2macroindex (const text_t &realindex);
33bool isdoclevelindex (const text_t &realindex);
34text_t getdoclevelindex (const text_tarray &indexmap);
35
36class mgsearchclass {
37public:
38 mgsearchclass ();
39 virtual ~mgsearchclass ();
40
41 // the index directory must be set before any searching
42 // is done
43 void setcollectdir (const text_t &thecollectdir);
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
61protected:
62 querycache *cache;
63 text_t collectdir; // the collection directory
64
65 void setsearchmode (const queryparamclass &queryparams);
66 void submitquery (const queryparamclass &queryparams);
67 void getresults (queryresultsclass &queryresults);
68
69 virtual void extractquoted (text_t &ttquerystring, text_t &ttquotedquery);
70 virtual void filterquery (text_t &ttquerystring);
71};
72
73
74#endif
Note: See TracBrowser for help on using the repository browser.