[ci] Update macos jobs
[xapian.git] / xapian-applications / omega / clickmodel / session.h
blob124f4755bc0ee66a7e3cfeb289894c51f9ad9cc9
1 /** @file
2 * @brief Session class for handling search session data.
3 */
4 /* Copyright (C) 2017 Vivek Pal
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef OMEGA_INCLUDED_SESSION_H
22 #define OMEGA_INCLUDED_SESSION_H
24 #include <string>
25 #include <vector>
27 #define QID 0
28 #define DOCIDS 1
29 #define CLICKS 2
31 /**
32 * Session class for handling search session data elements.
34 class Session {
35 /// Each session contains data elements stored as std::string.
36 std::vector<std::string> session;
37 public:
38 /** Creates a new session with the given data elements.
40 * @param qid Query id.
41 * @param docids Document ids in the search session.
42 * @param clicks Click information corresponding to the docids.
44 void create_session(std::string qid, std::string docids,
45 std::string clicks) {
46 session.push_back(qid);
47 session.push_back(docids);
48 session.push_back(clicks);
51 /// Retrieve the query id of the session.
52 std::string get_qid() const { return session[QID]; }
54 /// Retrieve the docids string of the session.
55 std::string get_docids() const { return session[DOCIDS]; }
57 /// Retrieve the clicks string of the session.
58 std::string get_clicks() const { return session[CLICKS]; }
61 #endif // OMEGA_INCLUDED_SESSION_H