|
a/src/rcldb/rclquery_p.h |
|
b/src/rcldb/rclquery_p.h |
1 |
#ifndef _rclquery_p_h_included_
|
1 |
#ifndef _rclquery_p_h_included_
|
2 |
#define _rclquery_p_h_included_
|
2 |
#define _rclquery_p_h_included_
|
3 |
/* @(#$Id: rclquery_p.h,v 1.1 2008-06-13 18:22:46 dockes Exp $ (C) 2007 J.F.Dockes */
|
3 |
/* @(#$Id: rclquery_p.h,v 1.2 2008-07-01 08:31:08 dockes Exp $ (C) 2007 J.F.Dockes */
|
4 |
|
4 |
|
5 |
#include <map>
|
5 |
#include <map>
|
6 |
#include <vector>
|
6 |
#include <vector>
|
7 |
|
7 |
|
8 |
using std::map;
|
8 |
using std::map;
|
|
... |
|
... |
13 |
|
13 |
|
14 |
namespace Rcl {
|
14 |
namespace Rcl {
|
15 |
|
15 |
|
16 |
class Query::Native {
|
16 |
class Query::Native {
|
17 |
public:
|
17 |
public:
|
18 |
Xapian::Query query; // query descriptor: terms and subqueries
|
18 |
/** The query I belong to */
|
19 |
// joined by operators (or/and etc...)
|
19 |
Query *m_q;
|
|
|
20 |
/** query descriptor: terms and subqueries joined by operators
|
|
|
21 |
* (or/and etc...)
|
|
|
22 |
*/
|
|
|
23 |
Xapian::Query query;
|
20 |
|
24 |
|
21 |
vector<int> m_dbindices; // In case there is a postq filter: sequence of
|
25 |
/** In case there is a postq filter: sequence of db indices that match */
|
22 |
// db indices that match
|
26 |
vector<int> m_dbindices;
|
23 |
|
27 |
|
24 |
// Filtering results on location. There are 2 possible approaches
|
28 |
// Filtering results on location. There are 2 possible approaches
|
25 |
// for this:
|
29 |
// for this:
|
26 |
// - Set a "MatchDecider" to be used by Xapian during the query
|
30 |
// - Set a "MatchDecider" to be used by Xapian during the query
|
27 |
// - Filter the results out of Xapian (this also uses a
|
31 |
// - Filter the results out of Xapian (this also uses a
|
|
... |
|
... |
37 |
// cases).
|
41 |
// cases).
|
38 |
//
|
42 |
//
|
39 |
// Which is used is decided in SetQuery(), by setting either of
|
43 |
// Which is used is decided in SetQuery(), by setting either of
|
40 |
// the two following members. This in turn is controlled by a
|
44 |
// the two following members. This in turn is controlled by a
|
41 |
// preprocessor directive.
|
45 |
// preprocessor directive.
|
42 |
|
|
|
43 |
#define XAPIAN_FILTERING 1
|
46 |
#define XAPIAN_FILTERING 1
|
44 |
|
|
|
45 |
Xapian::MatchDecider *decider; // Xapian does the filtering
|
47 |
Xapian::MatchDecider *decider; // Xapian does the filtering
|
46 |
Xapian::MatchDecider *postfilter; // Result filtering done by Recoll
|
48 |
Xapian::MatchDecider *postfilter; // Result filtering done by Recoll
|
47 |
|
49 |
|
48 |
Xapian::Enquire *enquire; // Open query descriptor.
|
50 |
Xapian::Enquire *enquire; // Open query descriptor.
|
49 |
Xapian::MSet mset; // Partial result set
|
51 |
Xapian::MSet mset; // Partial result set
|
50 |
Query *m_q;
|
|
|
51 |
// Term frequencies for current query. See makeAbstract, setQuery
|
52 |
// Term frequencies for current query. See makeAbstract, setQuery
|
52 |
map<string, double> termfreqs;
|
53 |
map<string, double> termfreqs;
|
53 |
|
54 |
|
54 |
Native(Query *q)
|
55 |
Native(Query *q)
|
55 |
: decider(0), postfilter(0), enquire(0), m_q(q)
|
56 |
: m_q(q), decider(0), postfilter(0), enquire(0)
|
56 |
{ }
|
57 |
{ }
|
57 |
|
|
|
58 |
~Native() {
|
58 |
~Native() {
|
59 |
delete decider;
|
59 |
clear();
|
60 |
delete postfilter;
|
60 |
}
|
61 |
delete enquire;
|
61 |
void clear() {
|
|
|
62 |
m_dbindices.clear();
|
|
|
63 |
delete decider; decider = 0;
|
|
|
64 |
delete postfilter; postfilter = 0;
|
|
|
65 |
delete enquire; enquire = 0;
|
|
|
66 |
termfreqs.clear();
|
62 |
}
|
67 |
}
|
63 |
};
|
68 |
};
|
64 |
|
69 |
|
65 |
}
|
70 |
}
|
66 |
#endif /* _rclquery_p_h_included_ */
|
71 |
#endif /* _rclquery_p_h_included_ */
|