1 /** @file omenquireinternal.h
4 /* Copyright 1999,2000,2001 BrightStation PLC
5 * Copyright 2001,2002 Ananova Ltd
6 * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015,2016 Olly Betts
7 * Copyright 2009 Lemur Consulting Ltd
8 * Copyright 2011 Action Without Borders
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
26 #ifndef OM_HGUARD_OMENQUIREINTERNAL_H
27 #define OM_HGUARD_OMENQUIREINTERNAL_H
29 #include "xapian/database.h"
30 #include "xapian/document.h"
31 #include "xapian/enquire.h"
32 #include "xapian/query.h"
33 #include "xapian/rset.h"
34 #include "xapian/keymaker.h"
38 #include <unordered_map>
41 #include "weight/weightinternal.h"
52 /** Internals of enquire system.
53 * This allows the implementation of Xapian::Enquire to be hidden and reference
56 class Enquire::Internal
: public Xapian::Internal::intrusive_base
{
57 friend class MSet::Internal
;
59 /// The database which this enquire object uses.
60 const Xapian::Database db
;
69 Internal(const Internal
&);
70 /// Assignment not allowed
71 void operator=(const Internal
&);
74 typedef enum { REL
, VAL
, VAL_REL
, REL_VAL
} sort_setting
;
76 Xapian::valueno collapse_key
;
78 Xapian::doccount collapse_max
;
80 Xapian::Enquire::docid_order order
;
86 Xapian::valueno sort_key
;
88 bool sort_value_forward
;
90 Xapian::Internal::opt_intrusive_ptr
<KeyMaker
> sorter
;
94 /** The weight to use for this query.
96 * This is mutable so that the default BM25Weight object can be
97 * created lazily when first required.
99 mutable Weight
* weight
;
101 /// The weighting scheme to use for query expansion.
102 std::string eweightname
;
104 /// The parameter required for TradWeight query expansion.
107 vector
<Xapian::Internal::opt_intrusive_ptr
<MatchSpy
>> spies
;
109 explicit Internal(const Xapian::Database
&databases
);
112 /** Request a document from the database.
114 void request_doc(Xapian::docid did
) const;
116 Xapian::Document
get_document(Xapian::docid did
) const;
118 void set_query(const Query
& query_
, termcount qlen_
);
119 const Query
& get_query() const;
120 MSet
get_mset(Xapian::doccount first
, Xapian::doccount maxitems
,
121 Xapian::doccount check_at_least
,
123 const MatchDecider
*mdecider
) const;
125 ESet
get_eset(Xapian::termcount maxitems
, const RSet
& omrset
, int flags
,
126 const ExpandDecider
*edecider
, double min_wt
) const;
128 TermIterator
get_matching_terms(Xapian::docid did
) const;
129 TermIterator
get_matching_terms(const Xapian::MSetIterator
&it
) const;
131 Xapian::doccount
get_termfreq(const string
&tname
) const;
133 string
get_description() const;
138 #endif // OM_HGUARD_OMENQUIREINTERNAL_H