xapian-core  2.0.0
enquireinternal.h
Go to the documentation of this file.
1 
4 /* Copyright 2017,2024 Olly Betts
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_ENQUIREINTERNAL_H
22 #define XAPIAN_INCLUDED_ENQUIREINTERNAL_H
23 
25 #include "xapian/constants.h"
26 #include "xapian/database.h"
27 #include "xapian/enquire.h"
28 #include "xapian/intrusive_ptr.h"
29 #include "xapian/keymaker.h"
30 #include "xapian/matchspy.h"
31 #include "xapian/mset.h" // Only needed to forward declare MSet::Internal.
32 #include "xapian/query.h"
33 
34 #include <memory>
35 #include <string>
36 #include <vector>
37 
38 namespace Xapian {
39 
40 class ESet;
41 class RSet;
42 class Weight;
43 
45  friend class Enquire;
46  friend class MSet::Internal;
47 
48  public:
49  typedef enum { REL, VAL, VAL_REL, REL_VAL, DOCID } sort_setting;
50 
51  private:
53 
55 
57 
58  mutable std::unique_ptr<Xapian::Weight> weight;
59 
61 
63 
65 
67 
68  bool sort_val_reverse = false;
69 
71 
73 
75 
76  double weight_threshold = 0.0;
77 
78  std::vector<Xapian::Internal::opt_intrusive_ptr<MatchSpy>> matchspies;
79 
80  double time_limit = 0.0;
81 
83 
84  double expand_k = 1.0;
85 
86  public:
87  explicit
88  Internal(const Database& db_);
89 
90  MSet get_mset(doccount first,
91  doccount maxitems,
92  doccount checkatleast,
93  const RSet* rset,
94  const MatchDecider* mdecider) const;
95 
97 
98  ESet get_eset(termcount maxitems,
99  const RSet& rset,
100  int flags,
101  const ExpandDecider* edecider_,
102  double min_weight) const;
103 
104  doccount get_termfreq(std::string_view term) const {
105  return db.get_termfreq(term);
106  }
107 
109  // This is called by MSetIterator, so we know the document exists.
111  }
112 
113  void request_document(docid did) const {
114  db.internal->request_document(did);
115  }
116 };
117 
118 }
119 
120 #endif // XAPIAN_INCLUDED_ENQUIREINTERNAL_H
An indexed database of documents.
Definition: database.h:75
Xapian::doccount get_termfreq(std::string_view term) const
Get the number of documents indexed by a specified term.
Definition: database.cc:262
Xapian::Document get_document(Xapian::docid did, unsigned flags=0) const
Get a document from the database.
Definition: database.cc:368
Xapian::Internal::intrusive_ptr_nonnull< Internal > internal
Definition: database.h:95
Class representing a document.
Definition: document.h:64
Class representing a list of search results.
Definition: eset.h:42
Xapian::termcount query_length
std::unique_ptr< Xapian::Weight > weight
Xapian::Internal::opt_intrusive_ptr< Xapian::KeyMaker > sort_functor
Internal(const Database &db_)
Definition: enquire.cc:253
MSet get_mset(doccount first, doccount maxitems, doccount checkatleast, const RSet *rset, const MatchDecider *mdecider) const
Definition: enquire.cc:257
Xapian::valueno collapse_key
ESet get_eset(termcount maxitems, const RSet &rset, int flags, const ExpandDecider *edecider_, double min_weight) const
Definition: enquire.cc:434
enum Xapian::Enquire::Internal::@0 eweight
Xapian::doccount collapse_max
Document get_document(docid did) const
void request_document(docid did) const
doccount get_termfreq(std::string_view term) const
std::vector< Xapian::Internal::opt_intrusive_ptr< MatchSpy > > matchspies
TermIterator get_matching_terms_begin(docid did) const
Definition: enquire.cc:344
Querying session.
Definition: enquire.h:57
docid_order
Ordering of docids.
Definition: enquire.h:130
@ ASCENDING
docids sort in ascending order (default)
Definition: enquire.h:132
Virtual base class for expand decider functor.
Definition: expanddecider.h:38
Base class for objects managed by intrusive_ptr.
Definition: intrusive_ptr.h:50
Xapian::MSet internals.
Definition: msetinternal.h:44
Class representing a list of search results.
Definition: mset.h:46
Abstract base class for match deciders.
Definition: matchdecider.h:37
Class representing a query.
Definition: query.h:45
Class representing a set of documents judged as relevant.
Definition: rset.h:39
Class for iterating over a list of terms.
Definition: termiterator.h:41
Constants in the Xapian namespace.
An indexed database of documents.
string term
Virtual base class for Database internals.
Querying session.
Build key strings for MSet ordering or collapsing.
MatchSpy implementation.
Class representing a list of search results.
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
const valueno BAD_VALUENO
Reserved value to indicate "no valueno".
Definition: types.h:100
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:64
const int DOC_ASSUME_VALID
Assume document id is valid.
Definition: constants.h:275
unsigned valueno
The number for a value slot in a document.
Definition: types.h:90
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
Xapian::Query API class.