48 map<string, Xapian::Weight*, std::less<>>
wtschemes;
60 map<string, opt_intrusive_ptr<Xapian::KeyMaker>, std::less<>>
key_makers;
66 void clear_weighting_schemes();
69 void clear_posting_sources();
72 void clear_match_spies();
75 void clear_lat_long_metrics();
90 string name = obj->name();
93 "name() method returned empty "
97 auto r = registry.insert(make_pair(
name,
static_cast<T*
>(NULL)));
98 r.first->second = std::move(obj);
106 string name = obj.name();
111 auto r = registry.insert(make_pair(
name,
static_cast<T*
>(NULL)));
122 swap(
p, r.first->second);
126 T * clone = obj.clone();
131 r.first->second = clone;
136 static inline const T*
140 auto i = registry.find(
name);
141 if (i == registry.end()) {
144 return i->second.get();
149 static inline const T*
152 auto i = registry.find(
name);
153 if (i == registry.end()) {
161 Registry::Internal::Internal()
166 Registry::Internal::~Internal()
168 clear_weighting_schemes();
169 clear_posting_sources();
171 clear_lat_long_metrics();
175 Registry::Internal::add_defaults()
179 wtschemes[weighting_scheme->
name()] = weighting_scheme;
181 wtschemes[weighting_scheme->
name()] = weighting_scheme;
183 wtschemes[weighting_scheme->
name()] = weighting_scheme;
185 wtschemes[weighting_scheme->
name()] = weighting_scheme;
187 wtschemes[weighting_scheme->
name()] = weighting_scheme;
189 wtschemes[weighting_scheme->
name()] = weighting_scheme;
191 wtschemes[weighting_scheme->
name()] = weighting_scheme;
193 wtschemes[weighting_scheme->
name()] = weighting_scheme;
195 wtschemes[weighting_scheme->
name()] = weighting_scheme;
197 wtschemes[weighting_scheme->
name()] = weighting_scheme;
199 wtschemes[weighting_scheme->
name()] = weighting_scheme;
201 wtschemes[weighting_scheme->
name()] = weighting_scheme;
203 wtschemes[weighting_scheme->
name()] = weighting_scheme;
205 wtschemes[weighting_scheme->
name()] = weighting_scheme;
207 wtschemes[weighting_scheme->
name()] = weighting_scheme;
209 wtschemes[weighting_scheme->
name()] = weighting_scheme;
211 wtschemes[weighting_scheme->
name()] = weighting_scheme;
213 wtschemes[weighting_scheme->
name()] = weighting_scheme;
217 postingsources[source->
name()] = source;
219 postingsources[source->
name()] = source;
221 postingsources[source->
name()] = source;
223 postingsources[source->
name()] = source;
227 postingsources[source->
name()] = source;
231 matchspies[spy->
name()] = spy;
235 lat_long_metrics[metric->
name()] = metric;
239 key_makers[keymaker->
name()] = keymaker->
release();
243 Registry::Internal::clear_weighting_schemes()
245 for (
auto&& i : wtschemes) {
251 Registry::Internal::clear_posting_sources()
253 for (
auto&& i : postingsources) {
259 Registry::Internal::clear_match_spies()
261 for (
auto&& i : matchspies) {
267 Registry::Internal::clear_lat_long_metrics()
269 for (
auto&& i : lat_long_metrics) {
275 : internal(other.internal)
312 LOGCALL_VOID(API,
"Xapian::Registry::register_weighting_scheme", wt.
name());
326 LOGCALL_VOID(API,
"Xapian::Registry::register_posting_source", source.
name());
354 LOGCALL_VOID(API,
"Xapian::Registry::register_lat_long_metric", metric.
name());
368 LOGCALL_VOID(API,
"Xapian::Registry::register_key_maker", keymaker->
name());
This class implements the BB2 weighting scheme.
Xapian::Weight subclass implementing the BM25+ probabilistic formula.
Xapian::Weight subclass implementing the BM25 probabilistic formula.
Class implementing a "boolean" weighting scheme.
Xapian::Weight subclass implementing Coordinate Matching.
This class implements the DLH weighting scheme, which is a representative scheme of the Divergence fr...
This class implements the DPH weighting scheme.
Read weights from a value which is known to decrease as docid increases.
Xapian::Weight subclass implementing Dice Coefficient.
A posting source which returns a fixed weight for all documents.
Calculate the great-circle distance between two coordinates on a sphere.
This class implements the IfB2 weighting scheme.
This class implements the InL2 weighting scheme.
This class implements the IneB2 weighting scheme.
Base class for objects managed by intrusive_ptr.
A smart pointer that optionally uses intrusive reference counting.
InvalidOperationError indicates the API was used in an invalid way.
Virtual base class for key making functors.
KeyMaker * release()
Start reference counting this object.
virtual std::string name() const
Return the name of this KeyMaker.
Language Model weighting with Two Stage smoothing.
Language Model weighting with Absolute Discount smoothing.
Language Model weighting with Dirichlet or Dir+ smoothing.
Language Model weighting with Jelinek-Mercer smoothing.
A sequence of latitude-longitude coordinates.
Posting source which returns a weight based on geospatial distance.
Base class for calculating distances between two lat/long coordinates.
virtual std::string name() const =0
Return the full name of the metric.
Abstract base class for match spies.
virtual std::string name() const
Return the name of this match spy.
KeyMaker subclass which combines several values.
Xapian::Weight subclass implementing the PL2+ probabilistic formula.
This class implements the PL2 weighting scheme.
Base class which provides an "external" source of postings.
virtual std::string name() const
Name of the posting source class.
map< string, Xapian::LatLongMetric *, std::less<> > lat_long_metrics
Registered lat-long metrics.
map< string, Xapian::MatchSpy *, std::less<> > matchspies
Registered match spies.
map< string, Xapian::Weight *, std::less<> > wtschemes
Registered weighting schemes.
map< string, Xapian::PostingSource *, std::less<> > postingsources
Registered external posting sources.
map< string, opt_intrusive_ptr< Xapian::KeyMaker >, std::less<> > key_makers
Registered KeyMaker subclasses.
Registry for user subclasses.
const Xapian::PostingSource * get_posting_source(std::string_view name) const
Get a posting source given a name.
void register_lat_long_metric(const Xapian::LatLongMetric &metric)
Register a user-defined lat-long metric class.
Registry()
Default constructor.
const Xapian::MatchSpy * get_match_spy(std::string_view name) const
Get a match spy given a name.
void register_posting_source(const Xapian::PostingSource &source)
Register a user-defined posting source class.
const Xapian::Weight * get_weighting_scheme(std::string_view name) const
Get the weighting scheme given a name.
void register_key_maker(Xapian::KeyMaker *keymaker)
Register a user-defined KeyMaker subclass.
void register_weighting_scheme(const Xapian::Weight &wt)
Register a weighting scheme.
void register_match_spy(const Xapian::MatchSpy &spy)
Register a user-defined match spy class.
Xapian::Internal::intrusive_ptr_nonnull< Internal > internal
Registry & operator=(const Registry &other)
Assignment operator.
const Xapian::KeyMaker * get_key_maker(std::string_view name) const
Get a KeyMaker given a name.
const Xapian::LatLongMetric * get_lat_long_metric(std::string_view name) const
Get a lat-long metric given a name.
Xapian::Weight subclass implementing the tf-idf weighting scheme.
Class for counting the frequencies of values in the matching documents.
A posting source which looks up weights in a map using values as the key.
A posting source which reads weights from a value slot.
Abstract base class for weighting schemes.
virtual std::string name() const
Return the name of this weighting scheme, e.g.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
#define LOGCALL_DTOR(CATEGORY, CLASS)
Hierarchy of classes which Xapian can throw as exceptions.
Geospatial search support routines.
The Xapian namespace contains public interfaces for the Xapian library.
External sources of posting information.
static const T * lookup_object(map< string, opt_intrusive_ptr< T >, std::less<>> registry, string_view name)
Look up an optionally ref-counted object.
static void register_object(map< string, opt_intrusive_ptr< T >, std::less<>> ®istry, T *obj_)
Register an optionally ref-counted object.
Class for looking up user subclasses during unserialisation.
Various handy string-related helpers.