Switch to unified view

a/src/rcldb/rclquery.h b/src/rcldb/rclquery.h
...
...
60
 * cursor in an rdb.
60
 * cursor in an rdb.
61
 *
61
 *
62
 */
62
 */
63
class Query {
63
class Query {
64
 public:
64
 public:
65
    /** The constructor only allocates memory */
66
    Query(Db *db);
65
    Query(Db *db);
67
    ~Query();
66
    ~Query();
68
67
69
    /** Get explanation about last error */
68
    /** Get explanation about last error */
70
    std::string getReason() const;
69
    std::string getReason() const
70
    {
71
  return m_reason;
72
    }
71
73
72
    /** Choose sort order. Must be called before setQuery */
74
    /** Choose sort order. Must be called before setQuery */
73
    void setSortBy(const std::string& fld, bool ascending = true);
75
    void setSortBy(const std::string& fld, bool ascending = true);
74
    const std::string& getSortBy() const {return m_sortField;}
76
    const std::string& getSortBy() const 
75
    bool getSortAscending() const {return m_sortAscending;}
77
    {
78
  return m_sortField;
79
    }
80
    bool getSortAscending() const 
81
    {
82
  return m_sortAscending;
83
    }
76
84
77
    /** Return or filter results with identical content checksum */
85
    /** Return or filter results with identical content checksum */
78
    void setCollapseDuplicates(bool on) {m_collapseDuplicates = on;}
86
    void setCollapseDuplicates(bool on) 
87
    {
88
  m_collapseDuplicates = on;
89
    }
79
90
80
    /** Accept data describing the search and query the index. This can
91
    /** Accept data describing the search and query the index. This can
81
     * be called repeatedly on the same object which gets reinitialized each
92
     * be called repeatedly on the same object which gets reinitialized each
82
     * time.
93
     * time.
83
     */
94
     */
...
...
90
    bool getDoc(int i, Doc &doc);
101
    bool getDoc(int i, Doc &doc);
91
102
92
    /** Get possibly expanded list of query terms */
103
    /** Get possibly expanded list of query terms */
93
    bool getQueryTerms(std::vector<std::string>& terms);
104
    bool getQueryTerms(std::vector<std::string>& terms);
94
105
95
    /** Return a list of terms which matched for a specific result document */
96
    bool getMatchTerms(const Doc& doc, std::vector<std::string>& terms);
97
    bool getMatchTerms(unsigned long xdocid, std::vector<std::string>& terms);
98
99
    /** Build synthetic abstract for document, extracting chunks relevant for
106
    /** Build synthetic abstract for document, extracting chunks relevant for
100
     * the input query. This uses index data only (no access to the file) */
107
     * the input query. This uses index data only (no access to the file) */
101
    // Abstract return as one string
108
    // Abstract returned as one string
102
    bool makeDocAbstract(Doc &doc, std::string& abstract);
109
    bool makeDocAbstract(Doc &doc, std::string& abstract);
103
    // Returned as a snippets vector
110
    // Returned as a snippets vector
104
    bool makeDocAbstract(Doc &doc, std::vector<std::string>& abstract);
111
    bool makeDocAbstract(Doc &doc, std::vector<std::string>& abstract);
105
    // Returned as a vector of pair<page,snippet> page is 0 if unknown
112
    // Returned as a vector of pair<page,snippet> page is 0 if unknown
106
    abstract_result makeDocAbstract(Doc &doc, std::vector<Snippet>& abst, 
113
    abstract_result makeDocAbstract(Doc &doc, std::vector<Snippet>& abst, 
107
                    int maxoccs= -1, int ctxwords = -1);
114
                    int maxoccs= -1, int ctxwords = -1);
108
    /** Retrieve detected page breaks positions */
115
    /** Retrieve page number for first match for term */
109
    int getFirstMatchPage(Doc &doc, std::string& term);
116
    int getFirstMatchPage(Doc &doc, std::string& term);
117
118
    /** Retrieve a reference to the searchData we are using */
119
    RefCntr<SearchData> getSD() 
120
    {
121
  return m_sd;
122
    }
110
123
111
    /** Expand query to look for documents like the one passed in */
124
    /** Expand query to look for documents like the one passed in */
112
    std::vector<std::string> expand(const Doc &doc);
125
    std::vector<std::string> expand(const Doc &doc);
113
126
114
    /** Return the Db we're set for */
127
    /** Return the Db we're set for */
115
    Db *whatDb();
128
    Db *whatDb() const
129
    {
130
  return m_db;
131
    }
116
132
117
    /* make this public for access from embedded Db::Native */
133
    /* make this public for access from embedded Db::Native */
118
    class Native;
134
    class Native;
119
    Native *m_nq;
135
    Native *m_nq;
120
136