strus  0.17
vectorQueryResult.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_VECTOR_QUERY_RESULT_HPP_INCLUDED
11 #define _STRUS_VECTOR_QUERY_RESULT_HPP_INCLUDED
12 #include <string>
13 
14 namespace strus {
15 
18 {
19 public:
22  :m_value(),m_weight(0.0){}
25  :m_value(o.m_value),m_weight(o.m_weight){}
27  VectorQueryResult( const std::string& value_, double weight_)
28  :m_value(value_),m_weight(weight_){}
29 
30  const std::string& value() const {return m_value;}
31  double weight() const {return m_weight;}
32 
33  bool operator < (const VectorQueryResult& o) const
34  {
35  if (m_weight < o.m_weight) return true;
36  if (m_weight > o.m_weight) return true;
37  return m_value < o.m_value;
38  }
39 
40 private:
41  std::string m_value;
42  double m_weight;
43 };
44 
45 }//namespace
46 #endif
47 
double weight() const
Definition: vectorQueryResult.hpp:31
const std::string & value() const
Definition: vectorQueryResult.hpp:30
VectorQueryResult()
Default constructor.
Definition: vectorQueryResult.hpp:21
VectorQueryResult(const VectorQueryResult &o)
Copy constructor.
Definition: vectorQueryResult.hpp:24
VectorQueryResult(const std::string &value_, double weight_)
Constructor.
Definition: vectorQueryResult.hpp:27
bool operator<(const VectorQueryResult &o) const
Definition: vectorQueryResult.hpp:33
Result of a vector similarity search (associated feature value with weight)
Definition: vectorQueryResult.hpp:17