source: trunk/gsdl/src/colservr/queryinfo.h@ 190

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

Made the source more portable.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
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 114 1999-01-19 01:38:20Z rjmcnab $
9 *
10 *********************************************************************/
11
12
13#ifndef QUERYINFO_H
14#define QUERYINFO_H
15
16
17#include "gsdlconf.h"
18#include "text_t.h"
19
20#if defined(GSDL_USE_OBJECTSPACE)
21# include <ospace\std\vector>
22# include <ospace\std\algorithm>
23#elif defined(GSDL_USE_STL_H)
24# include <vector.h>
25# if defined(GSDL_USE_ALGO_H)
26# include <algo.h>
27# else
28# include <algorithm.h>
29# endif
30#else
31# include <vector>
32# include <algorithm>
33#endif
34
35// query parameters
36
37class queryparamclass
38{
39public:
40 text_t collection;
41 text_t search_index;
42 text_t querystring;
43 int search_type; // 0 = boolean, 1 = ranked
44 int casefolding;
45 int stemming;
46 int maxdocs;
47
48 queryparamclass &operator=(const queryparamclass &q);
49};
50
51bool operator==(const queryparamclass &x, const queryparamclass &y);
52bool operator!=(const queryparamclass &x, const queryparamclass &y);
53
54// stream output for debugging purposes
55ostream &operator<< (ostream &outs, queryparamclass &q);
56
57
58
59// term frequencies
60
61class termfreqclass
62{
63public:
64 text_t termstr;
65 unsigned int termfreq;
66
67 termfreqclass &operator=(const termfreqclass &t);
68};
69
70bool operator==(const termfreqclass &x, const termfreqclass &y);
71bool operator!=(const termfreqclass &x, const termfreqclass &y);
72bool operator<(const termfreqclass &x, const termfreqclass &y);
73bool operator>(const termfreqclass &x, const termfreqclass &y);
74
75// stream output for debugging purposes
76ostream &operator<< (ostream &outs, termfreqclass &q);
77
78
79
80// one query result
81
82class docresultclass
83{
84public:
85 docresultclass(void) {docnum=-1;docweight=0.0;};
86 ~docresultclass(void) {};
87
88 int docnum;
89 float docweight;
90};
91
92// stream output for debugging purposes
93ostream &operator<< (ostream &outs, docresultclass &a);
94
95
96
97// query results
98
99class queryresultsclass
100{
101public:
102 vector<docresultclass> docs;
103 vector<termfreqclass> terms;
104 vector<text_t> termvariants;
105
106 void clear ();
107 queryresultsclass &operator=(const queryresultsclass &q);
108
109 int getnumdocs () {return docs.size();}
110 int getnumterms () {return terms.size();}
111
112 void sortqueryterms();
113 void uniqqueryterms();
114};
115
116// stream output for debugging purposes
117ostream &operator<< (ostream &outs, queryresultsclass &q);
118
119
120#endif
Note: See TracBrowser for help on using the repository browser.