Switch to unified view

a/src/rcldb/rclquery_p.h b/src/rcldb/rclquery_p.h
...
...
15
15
16
class Query::Native {
16
class Query::Native {
17
public:
17
public:
18
    /** The query I belong to */
18
    /** The query I belong to */
19
    Query                *m_q;
19
    Query                *m_q;
20
21
20
    /** query descriptor: terms and subqueries joined by operators
22
    /** query descriptor: terms and subqueries joined by operators
21
     * (or/and etc...)
23
     * (or/and etc...)
22
     */
24
     */
23
    Xapian::Query    xquery; 
25
    Xapian::Query    xquery; 
24
25
    /** In case there is a postq filter: sequence of db indices that match */
26
    vector<int> m_dbindices; 
27
28
    // Filtering results on location. There are 2 possible approaches
29
    // for this:
30
    //   - Set a "MatchDecider" to be used by Xapian during the query
31
    //   - Filter the results out of Xapian (this also uses a
32
    //     Xapian::MatchDecider object, but applied to the results by Recoll.
33
    // 
34
    // The result filtering approach was the first implemented. 
35
    //
36
    // The efficiency of both methods depend on the searches, so the code
37
    // for both has been kept.  A nice point for the Xapian approach is that
38
    // the result count estimate are correct (they are wrong with
39
    // the postfilter approach). It is also faster in some worst case scenarios
40
    // so this now the default (but the post-filtering is faster in many common
41
    // cases).
42
    // 
43
    // Which is used is decided in SetQuery(), by setting either of
44
    // the two following members. This in turn is controlled by a
45
    // preprocessor directive.
46
#define XAPIAN_FILTERING 1
47
    Xapian::MatchDecider *decider;   // Xapian does the filtering
48
    Xapian::MatchDecider *postfilter; // Result filtering done by Recoll
49
26
50
    Xapian::Enquire      *xenquire; // Open query descriptor.
27
    Xapian::Enquire      *xenquire; // Open query descriptor.
51
    Xapian::MSet          xmset;    // Partial result set
28
    Xapian::MSet          xmset;    // Partial result set
52
    // Term frequencies for current query. See makeAbstract, setQuery
29
    // Term frequencies for current query. See makeAbstract, setQuery
53
    map<string, double>  termfreqs; 
30
    map<string, double>  termfreqs; 
54
31
55
    Native(Query *q)
32
    Native(Query *q)
56
  : m_q(q), decider(0), postfilter(0), xenquire(0)
33
  : m_q(q), xenquire(0)
57
    { }
34
    { }
58
    ~Native() {
35
    ~Native() {
59
    clear();
36
    clear();
60
    }
37
    }
61
    void clear() {
38
    void clear() {
62
  m_dbindices.clear();
63
  delete decider; decider = 0;
64
  delete postfilter; postfilter = 0;
65
    delete xenquire; xenquire = 0;
39
    delete xenquire; xenquire = 0;
66
    termfreqs.clear();
40
    termfreqs.clear();
67
    }
41
    }
68
};
42
};
69
43