xapian-core  1.4.25
esetinternal.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2008,2010,2011 Olly Betts
5  * Copyright (C) 2011 Action Without Borders
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_INCLUDED_ESETINTERNAL_H
23 #define XAPIAN_INCLUDED_ESETINTERNAL_H
24 
25 #include "xapian/intrusive_ptr.h"
26 #include "xapian/enquire.h"
27 #include "xapian/eset.h"
28 #include "xapian/types.h"
29 
30 #include <algorithm>
31 #include <string>
32 #include <vector>
33 
34 namespace Xapian {
35  class Database;
36  class ExpandDecider;
37 
38  namespace Internal {
39  class ExpandWeight;
40 
42 class ExpandTerm {
43  friend class Xapian::ESetIterator;
44  friend class Xapian::ESet::Internal;
45 
47  double wt;
48 
50  std::string term;
51 
52  public:
54  ExpandTerm(double wt_, const std::string & term_)
55  : wt(wt_), term(term_) { }
56 
58  void swap(ExpandTerm & o) {
59  std::swap(wt, o.wt);
60  std::swap(term, o.term);
61  }
62 
64  bool operator<(const ExpandTerm & o) const {
65  if (wt > o.wt) return true;
66  if (wt < o.wt) return false;
67  return term > o.term;
68  }
69 
71  std::string get_description() const;
72 };
73 
74 }
75 
78  friend class ESet;
79  friend class ESetIterator;
80 
87 
89  std::vector<Xapian::Internal::ExpandTerm> items;
90 
92  void operator=(const Internal &);
93 
95  Internal(const Internal &);
96 
97  public:
99  Internal() : ebound(0) { }
100 
102  void expand(Xapian::termcount max_esize,
103  const Xapian::Database & db,
104  const Xapian::RSet & rset,
105  const Xapian::ExpandDecider * edecider,
107  double min_wt);
108 
110  std::string get_description() const;
111 };
112 
113 }
114 
115 #endif // XAPIAN_INCLUDED_ESETINTERNAL_H
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
typedefs for Xapian
This class is used to access a database, or a group of databases.
Definition: database.h:68
Internal()
Construct an empty ESet::Internal.
Definition: esetinternal.h:99
Class which actually implements Xapian::ESet.
Definition: esetinternal.h:77
Class combining a term and its expand weight.
Definition: esetinternal.h:42
Virtual base class for expand decider functor.
Definition: expanddecider.h:37
std::string term
The term.
Definition: esetinternal.h:50
API for running queries.
Class for calculating ESet term weights.
Definition: expandweight.h:114
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
std::string get_description() const
Return a string describing this object.
Definition: esetinternal.cc:48
void swap(ExpandTerm &o)
Implement custom swap for ESet sorting efficiency.
Definition: esetinternal.h:58
Base class for objects managed by intrusive_ptr.
Definition: intrusive_ptr.h:49
std::vector< Xapian::Internal::ExpandTerm > items
The ExpandTerm objects which represent the items in the ESet.
Definition: esetinternal.h:89
Iterator over a Xapian::ESet.
Definition: eset.h:160
bool operator<(const ExpandTerm &o) const
Ordering relation for ESet contents.
Definition: esetinternal.h:64
Class representing a list of query expansion terms.
Xapian::termcount ebound
This is a lower bound on the ESet size if an infinite number of results were requested.
Definition: esetinternal.h:86
Class representing a list of search results.
Definition: eset.h:43
ExpandTerm(double wt_, const std::string &term_)
Constructor.
Definition: esetinternal.h:54
double wt
The expand weight calculated for this term.
Definition: esetinternal.h:47
A relevance set (R-Set).
Definition: enquire.h:60