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 301 1999-06-27 22:07:27Z 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 |
|
---|
24 | class mgsearchclass {
|
---|
25 | public:
|
---|
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 | // the search results are returned in queryresults
|
---|
34 | // search returns 'true' if it was able to do a search
|
---|
35 | bool search(const queryparamclass &queryparams,
|
---|
36 | queryresultsclass &queryresults);
|
---|
37 |
|
---|
38 | // the document text for 'docnum' is placed in 'output'
|
---|
39 | // docTargetDocument returns 'true' if it was able to
|
---|
40 | // try to get a document
|
---|
41 | // collection is needed to see if an index from the
|
---|
42 | // collection is loaded. If no index has been loaded
|
---|
43 | // defaultindex is needed to load one
|
---|
44 | bool docTargetDocument(const text_t &defaultindex,
|
---|
45 | const text_t &collection,
|
---|
46 | int docnum,
|
---|
47 | text_t &output);
|
---|
48 |
|
---|
49 | protected:
|
---|
50 | querycache *cache;
|
---|
51 | text_t collectdir; // the collection directory
|
---|
52 |
|
---|
53 | void setsearchmode (const queryparamclass &queryparams);
|
---|
54 | void submitquery (const queryparamclass &queryparams);
|
---|
55 | void getresults (queryresultsclass &queryresults);
|
---|
56 |
|
---|
57 | virtual void extractquoted (text_t &ttquerystring, text_t &ttquotedquery);
|
---|
58 | virtual void filterquery (text_t &ttquerystring);
|
---|
59 | };
|
---|
60 |
|
---|
61 |
|
---|
62 | #endif
|
---|