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

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

Added a set of utf8 encoded equivalent terms of a query term. I also
added a flag for handling post-processing of the query.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 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 326 1999-07-01 03:56:17Z 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 text_t termstemstr;
66 text_tset utf8equivterms; // kept as utf8 string for fast matching
67 unsigned int termfreq;
68
69 termfreqclass &operator=(const termfreqclass &t);
70};
71
72bool operator==(const termfreqclass &x, const termfreqclass &y);
73bool operator!=(const termfreqclass &x, const termfreqclass &y);
74bool operator<(const termfreqclass &x, const termfreqclass &y);
75bool operator>(const termfreqclass &x, const termfreqclass &y);
76
77// stream output for debugging purposes
78ostream &operator<< (ostream &outs, termfreqclass &q);
79
80
81
82// one query result
83
84class docresultclass {
85public:
86 docresultclass(void) {
87 docnum=-1; docweight=0.0; num_query_terms_matched=0;
88 query_phrase_match=false;
89 };
90 ~docresultclass(void) {};
91
92 int docnum;
93 float docweight;
94 unsigned int num_query_terms_matched; // not available on all versions of mg
95 bool query_phrase_match; // not available on all versions of mg
96};
97
98// stream output for debugging purposes
99ostream &operator<< (ostream &outs, docresultclass &a);
100
101
102
103// query results
104
105class queryresultsclass {
106public:
107 queryresultsclass () {clear();}
108
109 bool docs_matched_set;
110 int docs_matched; // not available on all versions of mg
111 bool is_approx; // not available on all versions of mg
112
113 bool postprocessed; // whether this record has been post-processed
114
115 vector<docresultclass> docs;
116 vector<termfreqclass> orgterms; // terms before they are sorted and uniqued
117 vector<termfreqclass> terms;
118 text_tarray termvariants;
119
120 void clear ();
121 queryresultsclass &operator=(const queryresultsclass &q);
122
123 int getnumdocs () {
124 if (docs_matched_set) return docs_matched;
125 else return docs.size();
126 }
127 int getnumterms () {return terms.size();}
128
129 void sortuniqqueryterms();
130};
131
132// stream output for debugging purposes
133ostream &operator<< (ostream &outs, queryresultsclass &q);
134
135
136#endif
Note: See TracBrowser for help on using the repository browser.