1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * queryinfo.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: queryinfo.h 110 1999-01-08 09:02:22Z rjmcnab $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 |
|
---|
13 | #ifndef QUERYINFO_H
|
---|
14 | #define QUERYINFO_H
|
---|
15 |
|
---|
16 |
|
---|
17 | #include "text_t.h"
|
---|
18 |
|
---|
19 | #ifndef USE_OBJECTSPACE
|
---|
20 | # include <vector>
|
---|
21 | # include <algorithm>
|
---|
22 | #else
|
---|
23 | # include <ospace\std\vector>
|
---|
24 | # include <ospace\std\algorithm>
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | // query parameters
|
---|
28 |
|
---|
29 | class queryparamclass
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | text_t collection;
|
---|
33 | text_t search_index;
|
---|
34 | text_t querystring;
|
---|
35 | int search_type; // 0 = boolean, 1 = ranked
|
---|
36 | int casefolding;
|
---|
37 | int stemming;
|
---|
38 | int maxdocs;
|
---|
39 |
|
---|
40 | queryparamclass &operator=(const queryparamclass &q);
|
---|
41 | };
|
---|
42 |
|
---|
43 | bool operator==(const queryparamclass &x, const queryparamclass &y);
|
---|
44 | bool operator!=(const queryparamclass &x, const queryparamclass &y);
|
---|
45 |
|
---|
46 | // stream output for debugging purposes
|
---|
47 | ostream &operator<< (ostream &outs, queryparamclass &q);
|
---|
48 |
|
---|
49 |
|
---|
50 |
|
---|
51 | // term frequencies
|
---|
52 |
|
---|
53 | class termfreqclass
|
---|
54 | {
|
---|
55 | public:
|
---|
56 | text_t termstr;
|
---|
57 | unsigned int termfreq;
|
---|
58 |
|
---|
59 | termfreqclass &operator=(const termfreqclass &t);
|
---|
60 | };
|
---|
61 |
|
---|
62 | bool operator==(const termfreqclass &x, const termfreqclass &y);
|
---|
63 | bool operator!=(const termfreqclass &x, const termfreqclass &y);
|
---|
64 | bool operator<(const termfreqclass &x, const termfreqclass &y);
|
---|
65 | bool operator>(const termfreqclass &x, const termfreqclass &y);
|
---|
66 |
|
---|
67 | // stream output for debugging purposes
|
---|
68 | ostream &operator<< (ostream &outs, termfreqclass &q);
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | // one query result
|
---|
73 |
|
---|
74 | class docresultclass
|
---|
75 | {
|
---|
76 | public:
|
---|
77 | int docnum;
|
---|
78 | float docweight;
|
---|
79 | };
|
---|
80 |
|
---|
81 | // stream output for debugging purposes
|
---|
82 | ostream &operator<< (ostream &outs, docresultclass &a);
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 | // query results
|
---|
87 |
|
---|
88 | class queryresultsclass
|
---|
89 | {
|
---|
90 | public:
|
---|
91 | vector<docresultclass> docs;
|
---|
92 | vector<termfreqclass> terms;
|
---|
93 | vector<text_t> termvariants;
|
---|
94 |
|
---|
95 | void clear ();
|
---|
96 | queryresultsclass &operator=(const queryresultsclass &q);
|
---|
97 |
|
---|
98 | int getnumdocs () {return docs.size();}
|
---|
99 | int getnumterms () {return terms.size();}
|
---|
100 |
|
---|
101 | void sortqueryterms();
|
---|
102 | void uniqqueryterms();
|
---|
103 | };
|
---|
104 |
|
---|
105 | // stream output for debugging purposes
|
---|
106 | ostream &operator<< (ostream &outs, queryresultsclass &q);
|
---|
107 |
|
---|
108 |
|
---|
109 | #endif
|
---|