60 void clear_weighting_schemes();
63 void clear_posting_sources();
66 void clear_match_spies();
69 void clear_lat_long_metrics();
80 string name = obj.name();
85 pair<typename map<string, T *>::iterator,
bool> r;
86 r = registry.insert(make_pair(
name,
static_cast<T*
>(NULL)));
97 swap(p, r.first->second);
101 T * clone = obj.clone();
106 r.first->second = clone;
110 static inline const T *
113 typename map<string, T*>::const_iterator i = registry.find(
name);
114 if (i == registry.end()) {
122 Registry::Internal::Internal()
127 Registry::Internal::~Internal()
129 clear_weighting_schemes();
130 clear_posting_sources();
132 clear_lat_long_metrics();
136 Registry::Internal::add_defaults()
140 wtschemes[weighting_scheme->
name()] = weighting_scheme;
142 wtschemes[weighting_scheme->
name()] = weighting_scheme;
144 wtschemes[weighting_scheme->
name()] = weighting_scheme;
146 wtschemes[weighting_scheme->
name()] = weighting_scheme;
148 wtschemes[weighting_scheme->
name()] = weighting_scheme;
150 wtschemes[weighting_scheme->
name()] = weighting_scheme;
152 wtschemes[weighting_scheme->
name()] = weighting_scheme;
154 wtschemes[weighting_scheme->
name()] = weighting_scheme;
156 wtschemes[weighting_scheme->
name()] = weighting_scheme;
158 wtschemes[weighting_scheme->
name()] = weighting_scheme;
160 wtschemes[weighting_scheme->
name()] = weighting_scheme;
162 wtschemes[weighting_scheme->
name()] = weighting_scheme;
164 wtschemes[weighting_scheme->
name()] = weighting_scheme;
166 wtschemes[weighting_scheme->
name()] = weighting_scheme;
168 wtschemes[weighting_scheme->
name()] = weighting_scheme;
172 postingsources[source->
name()] = source;
174 postingsources[source->
name()] = source;
176 postingsources[source->
name()] = source;
178 postingsources[source->
name()] = source;
182 postingsources[source->
name()] = source;
186 matchspies[spy->
name()] = spy;
190 lat_long_metrics[metric->
name()] = metric;
194 Registry::Internal::clear_weighting_schemes()
196 map<string, Xapian::Weight*>::const_iterator i;
197 for (i = wtschemes.begin(); i != wtschemes.end(); ++i) {
203 Registry::Internal::clear_posting_sources()
205 map<string, Xapian::PostingSource *>::const_iterator i;
206 for (i = postingsources.begin(); i != postingsources.end(); ++i) {
212 Registry::Internal::clear_match_spies()
214 map<string, Xapian::MatchSpy *>::const_iterator i;
215 for (i = matchspies.begin(); i != matchspies.end(); ++i) {
221 Registry::Internal::clear_lat_long_metrics()
223 map<string, Xapian::LatLongMetric *>::const_iterator i;
224 for (i = lat_long_metrics.begin(); i != lat_long_metrics.end(); ++i) {
230 : internal(other.internal)
267 LOGCALL_VOID(API,
"Xapian::Registry::register_weighting_scheme", wt.
name());
281 LOGCALL_VOID(API,
"Xapian::Registry::register_posting_source", source.
name());
309 LOGCALL_VOID(API,
"Xapian::Registry::register_lat_long_metric", metric.
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.
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.
InvalidOperationError indicates the API was used in an invalid way.
Xapian::Weight subclass implementing the Language Model formula.
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.
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.
std::map< std::string, Xapian::LatLongMetric * > lat_long_metrics
Registered lat-long metrics.
std::map< std::string, Xapian::Weight * > wtschemes
Registered weighting schemes.
std::map< std::string, Xapian::PostingSource * > postingsources
Registered external posting sources.
std::map< std::string, Xapian::MatchSpy * > matchspies
Registered match spies.
Registry for user subclasses.
const Xapian::Weight * get_weighting_scheme(const std::string &name) const
Get the weighting scheme given a name.
void register_lat_long_metric(const Xapian::LatLongMetric &metric)
Register a user-defined lat-long metric class.
Registry()
Default constructor.
void register_posting_source(const Xapian::PostingSource &source)
Register a user-defined posting source class.
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< Internal > internal
Registry & operator=(const Registry &other)
Assignment operator.
const Xapian::MatchSpy * get_match_spy(const std::string &name) const
Get a match spy given a name.
const Xapian::LatLongMetric * get_lat_long_metric(const std::string &name) const
Get a lat-long metric given a name.
const Xapian::PostingSource * get_posting_source(const std::string &name) const
Get a posting source given a name.
Xapian::Weight subclass implementing the tf-idf weighting scheme.
Xapian::Weight subclass implementing the traditional probabilistic formula.
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.
#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 void register_object(map< string, T * > ®istry, const T &obj)
static const T * lookup_object(map< string, T * > registry, const string &name)
Class for looking up user subclasses during unserialisation.