compactor.h   compactor.h 
/** @file compactor.h /** @file compactor.h
* @brief Compact a database, or merge and compact several. * @brief Compact a database, or merge and compact several.
*/ */
/* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010,2011 Olly Betts /* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010,2011,2013 Olly Bet ts
* Copyright (C) 2008 Lemur Consulting Ltd * Copyright (C) 2008 Lemur Consulting Ltd
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 26 skipping to change at line 26
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_COMPACTOR_H #ifndef XAPIAN_INCLUDED_COMPACTOR_H
#define XAPIAN_INCLUDED_COMPACTOR_H #define XAPIAN_INCLUDED_COMPACTOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/compactor.h> directly; include <xapian.h> instea
d."
#endif
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
/** Compact a database, or merge and compact several. /** Compact a database, or merge and compact several.
*/ */
class XAPIAN_VISIBILITY_DEFAULT Compactor { class XAPIAN_VISIBILITY_DEFAULT Compactor {
public: public:
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 database.h   database.h 
/** @file database.h /** @file database.h
* @brief API for working with Xapian databases * @brief API for working with Xapian databases
*/ */
/* Copyright 1999,2000,2001 BrightStation PLC /* Copyright 1999,2000,2001 BrightStation PLC
* Copyright 2002 Ananova Ltd * Copyright 2002 Ananova Ltd
* Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2011,2012 Olly Betts * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013 Olly Be tts
* Copyright 2006,2008 Lemur Consulting Ltd * Copyright 2006,2008 Lemur Consulting Ltd
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 28 skipping to change at line 28
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_DATABASE_H #ifndef XAPIAN_INCLUDED_DATABASE_H
#define XAPIAN_INCLUDED_DATABASE_H #define XAPIAN_INCLUDED_DATABASE_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/database.h> directly; include <xapian.h> instead
."
#endif
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/positioniterator.h> #include <xapian/positioniterator.h>
#include <xapian/postingiterator.h> #include <xapian/postingiterator.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/valueiterator.h> #include <xapian/valueiterator.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
skipping to change at line 175 skipping to change at line 180
* cached) * cached)
* *
* - raise a Xapian::DatabaseError exception indicating that the * - raise a Xapian::DatabaseError exception indicating that the
* database is closed. * database is closed.
* *
* The reason for this behaviour is that otherwise we'd have to che ck * The reason for this behaviour is that otherwise we'd have to che ck
* that the database is still open on every method call on every * that the database is still open on every method call on every
* object associated with a Database, when in many cases they are * object associated with a Database, when in many cases they are
* working on data which has already been loaded and so they are ab le * working on data which has already been loaded and so they are ab le
* to just behave correctly. * to just behave correctly.
*
* This method was added in Xapian 1.1.0.
*/ */
virtual void close(); virtual void close();
/// Return a string describing this object. /// Return a string describing this object.
virtual std::string get_description() const; virtual std::string get_description() const;
/** An iterator pointing to the start of the postlist /** An iterator pointing to the start of the postlist
* for a given term. * for a given term.
* *
* @param tname The termname to iterate postings for. If th e * @param tname The termname to iterate postings for. If th e
* term name is the empty string, the iterator * term name is the empty string, the iterator
* returned will list all the documents in the * returned will list all the documents in the
* database. Such an iterator will always retu rn * database. Such an iterator will always retu rn
* a WDF value of 1, since there is no obvious * a WDF value of 1, since there is no obvious
* meaning for this quantity in this case. * meaning for this quantity in this case.
*/ */
PostingIterator postlist_begin(const std::string &tname) const; PostingIterator postlist_begin(const std::string &tname) const;
/** Corresponding end iterator to postlist_begin(). /** Corresponding end iterator to postlist_begin().
*/ */
PostingIterator postlist_end(const std::string &) const { PostingIterator XAPIAN_NOTHROW(postlist_end(const std::string &) con st) {
return PostingIterator(); return PostingIterator();
} }
/** An iterator pointing to the start of the termlist /** An iterator pointing to the start of the termlist
* for a given document. * for a given document.
* *
* @param did The document id of the document to iterate terms for . * @param did The document id of the document to iterate terms for .
*/ */
TermIterator termlist_begin(Xapian::docid did) const; TermIterator termlist_begin(Xapian::docid did) const;
/** Corresponding end iterator to termlist_begin(). /** Corresponding end iterator to termlist_begin().
*/ */
TermIterator termlist_end(Xapian::docid) const { TermIterator XAPIAN_NOTHROW(termlist_end(Xapian::docid) const) {
return TermIterator(); return TermIterator();
} }
/** Does this database have any positional information? */ /** Does this database have any positional information? */
bool has_positions() const; bool has_positions() const;
/** An iterator pointing to the start of the position list /** An iterator pointing to the start of the position list
* for a given term in a given document. * for a given term in a given document.
*/ */
PositionIterator positionlist_begin(Xapian::docid did, const std::st ring &tname) const; PositionIterator positionlist_begin(Xapian::docid did, const std::st ring &tname) const;
/** Corresponding end iterator to positionlist_begin(). /** Corresponding end iterator to positionlist_begin().
*/ */
PositionIterator positionlist_end(Xapian::docid, const std::string & ) const { PositionIterator XAPIAN_NOTHROW(positionlist_end(Xapian::docid, cons t std::string &) const) {
return PositionIterator(); return PositionIterator();
} }
/** An iterator which runs across all terms in the database. /** An iterator which runs across all terms in the database.
*/ */
TermIterator allterms_begin() const; TermIterator allterms_begin() const;
/** Corresponding end iterator to allterms_begin(). /** Corresponding end iterator to allterms_begin().
*/ */
TermIterator allterms_end() const { TermIterator XAPIAN_NOTHROW(allterms_end() const) {
return TermIterator(); return TermIterator();
} }
/** An iterator which runs across all terms with a given prefix. /** An iterator which runs across all terms with a given prefix.
* *
* This is functionally similar to getting an iterator with * This is functionally similar to getting an iterator with
* allterms_begin() and then calling skip_to(prefix) on that iterat or * allterms_begin() and then calling skip_to(prefix) on that iterat or
* to move to the start of the prefix, but is more convenient (beca use * to move to the start of the prefix, but is more convenient (beca use
* it detects the end of the prefixed terms), and may be more * it detects the end of the prefixed terms), and may be more
* efficient than simply calling skip_to() after opening the iterat or, * efficient than simply calling skip_to() after opening the iterat or,
* particularly for remote databases. * particularly for remote databases.
* *
* @param prefix The prefix to restrict the returned terms to. * @param prefix The prefix to restrict the returned terms to.
*/ */
TermIterator allterms_begin(const std::string & prefix) const; TermIterator allterms_begin(const std::string & prefix) const;
/** Corresponding end iterator to allterms_begin(prefix). /** Corresponding end iterator to allterms_begin(prefix).
*/ */
TermIterator allterms_end(const std::string &) const { TermIterator XAPIAN_NOTHROW(allterms_end(const std::string &) const) {
return TermIterator(); return TermIterator();
} }
/// Get the number of documents in the database. /// Get the number of documents in the database.
Xapian::doccount get_doccount() const; Xapian::doccount get_doccount() const;
/// Get the highest document id which has been used in the database. /// Get the highest document id which has been used in the database.
Xapian::docid get_lastdocid() const; Xapian::docid get_lastdocid() const;
/// Get the average length of the documents in the database. /// Get the average length of the documents in the database.
skipping to change at line 340 skipping to change at line 347
/// Get an upper bound on the length of a document in this DB. /// Get an upper bound on the length of a document in this DB.
Xapian::termcount get_doclength_upper_bound() const; Xapian::termcount get_doclength_upper_bound() const;
/// Get an upper bound on the wdf of term @a term. /// Get an upper bound on the wdf of term @a term.
Xapian::termcount get_wdf_upper_bound(const std::string & term) cons t; Xapian::termcount get_wdf_upper_bound(const std::string & term) cons t;
/// Return an iterator over the value in slot @a slot for each docum ent. /// Return an iterator over the value in slot @a slot for each docum ent.
ValueIterator valuestream_begin(Xapian::valueno slot) const; ValueIterator valuestream_begin(Xapian::valueno slot) const;
/// Return end iterator corresponding to valuestream_begin(). /// Return end iterator corresponding to valuestream_begin().
ValueIterator valuestream_end(Xapian::valueno) const { ValueIterator XAPIAN_NOTHROW(valuestream_end(Xapian::valueno) const) {
return ValueIterator(); return ValueIterator();
} }
/// Get the length of a document. /// Get the length of a document.
Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_doclength(Xapian::docid did) const;
/** Send a "keep-alive" to remote databases to stop them timing out. /** Send a "keep-alive" to remote databases to stop them timing out.
* *
* Has no effect on non-remote databases. * Has no effect on non-remote databases.
*/ */
skipping to change at line 391 skipping to change at line 398
/** An iterator which returns all the spelling correction targets. /** An iterator which returns all the spelling correction targets.
* *
* This returns all the words which are considered as targets for t he * This returns all the words which are considered as targets for t he
* spelling correction algorithm. The frequency of each word is * spelling correction algorithm. The frequency of each word is
* available as the term frequency of each entry in the returned * available as the term frequency of each entry in the returned
* iterator. * iterator.
*/ */
Xapian::TermIterator spellings_begin() const; Xapian::TermIterator spellings_begin() const;
/// Corresponding end iterator to spellings_begin(). /// Corresponding end iterator to spellings_begin().
Xapian::TermIterator spellings_end() const { Xapian::TermIterator XAPIAN_NOTHROW(spellings_end() const) {
return Xapian::TermIterator(); return Xapian::TermIterator();
} }
/** An iterator which returns all the synonyms for a given term. /** An iterator which returns all the synonyms for a given term.
* *
* @param term The term to return synonyms for. * @param term The term to return synonyms for.
*/ */
Xapian::TermIterator synonyms_begin(const std::string &term) const; Xapian::TermIterator synonyms_begin(const std::string &term) const;
/// Corresponding end iterator to synonyms_begin(term). /// Corresponding end iterator to synonyms_begin(term).
Xapian::TermIterator synonyms_end(const std::string &) const { Xapian::TermIterator XAPIAN_NOTHROW(synonyms_end(const std::string & ) const) {
return Xapian::TermIterator(); return Xapian::TermIterator();
} }
/** An iterator which returns all terms which have synonyms. /** An iterator which returns all terms which have synonyms.
* *
* @param prefix If non-empty, only terms with this prefix are * @param prefix If non-empty, only terms with this prefix are
* returned. * returned.
*/ */
Xapian::TermIterator synonym_keys_begin(const std::string &prefix = std::string()) const; Xapian::TermIterator synonym_keys_begin(const std::string &prefix = std::string()) const;
/// Corresponding end iterator to synonym_keys_begin(prefix). /// Corresponding end iterator to synonym_keys_begin(prefix).
Xapian::TermIterator synonym_keys_end(const std::string & = std::str ing()) const { Xapian::TermIterator XAPIAN_NOTHROW(synonym_keys_end(const std::stri ng & = std::string()) const) {
return Xapian::TermIterator(); return Xapian::TermIterator();
} }
/** Get the user-specified metadata associated with a given key. /** Get the user-specified metadata associated with a given key.
* *
* User-specified metadata allows you to store arbitrary informatio n * User-specified metadata allows you to store arbitrary informatio n
* in the form of (key,tag) pairs. See @a * in the form of (key,tag) pairs. See @a
* WritableDatabase::set_metadata() for more information. * WritableDatabase::set_metadata() for more information.
* *
* When invoked on a Xapian::Database object representing multiple * When invoked on a Xapian::Database object representing multiple
skipping to change at line 465 skipping to change at line 472
* returned. * returned.
* *
* @exception Xapian::UnimplementedError will be thrown if the * @exception Xapian::UnimplementedError will be thrown if the
* backend implements user-specified metadata, but * backend implements user-specified metadata, but
* doesn't implement iterating its keys (curren tly * doesn't implement iterating its keys (curren tly
* this happens for the InMemory backend). * this happens for the InMemory backend).
*/ */
Xapian::TermIterator metadata_keys_begin(const std::string &prefix = std::string()) const; Xapian::TermIterator metadata_keys_begin(const std::string &prefix = std::string()) const;
/// Corresponding end iterator to metadata_keys_begin(). /// Corresponding end iterator to metadata_keys_begin().
Xapian::TermIterator metadata_keys_end(const std::string & = std::st ring()) const { Xapian::TermIterator XAPIAN_NOTHROW(metadata_keys_end(const std::str ing & = std::string()) const) {
return Xapian::TermIterator(); return Xapian::TermIterator();
} }
/** Get a UUID for the database. /** Get a UUID for the database.
* *
* The UUID will persist for the lifetime of the database. * The UUID will persist for the lifetime of the database.
* *
* Replicas (eg, made with the replication protocol, or by copying all * Replicas (eg, made with the replication protocol, or by copying all
* the database files) will have the same UUID. However, copies (m ade * the database files) will have the same UUID. However, copies (m ade
* with copydatabase, or xapian-compact) will have different UUIDs. * with copydatabase, or xapian-compact) will have different UUIDs.
skipping to change at line 495 skipping to change at line 502
/** Check the integrity of a database or database table. /** Check the integrity of a database or database table.
* *
* This method is currently experimental, and may change incompatib ly * This method is currently experimental, and may change incompatib ly
* or possibly even be removed. Feedback on how well it works and * or possibly even be removed. Feedback on how well it works and
* how it might be improved are welcome. * how it might be improved are welcome.
* *
* @param path Path to database or table * @param path Path to database or table
* @param opts Options to use for check * @param opts Options to use for check
* @param out std::ostream to write output to * @param out std::ostream to write output to
*/ */
#ifndef check
static size_t check(const std::string & path, int opts, static size_t check(const std::string & path, int opts,
std::ostream &out); std::ostream &out);
#else
// The AssertMacros.h header in the OS X SDK currently defines a che
ck
// macro. Apple have deprecated check() in favour of __Check() and
// plan to remove check() in a "future release", but for now prevent
// expansion of check by adding parentheses in the method prototype:
// http://www.opensource.apple.com/source/CarbonHeaders/CarbonHeader
s-18.1/AssertMacros.h
//
// We do this conditionally, as these parentheses trip up SWIG's
// parser:
// https://github.com/swig/swig/issues/45
static size_t (check)(const std::string & path, int opts,
std::ostream &out);
#endif
/** Check the integrity of a database or database table. /** Check the integrity of a database or database table.
* *
* This method is currently experimental, and may change incompatib ly * This method is currently experimental, and may change incompatib ly
* or possibly even be removed. Feedback on how well it works and * or possibly even be removed. Feedback on how well it works and
* how it might be improved are welcome. * how it might be improved are welcome.
* *
* @param path Path to database or table * @param path Path to database or table
* @param opts Options to use for check * @param opts Options to use for check
*/ */
skipping to change at line 993 skipping to change at line 1014
* For use with Xapian::Database::check(). * For use with Xapian::Database::check().
*/ */
const int DBCHECK_SHOW_BITMAP = 4; const int DBCHECK_SHOW_BITMAP = 4;
/** Show statistics for the B-tree. /** Show statistics for the B-tree.
* *
* For use with Xapian::Database::check(). * For use with Xapian::Database::check().
*/ */
const int DBCHECK_SHOW_STATS = 8; const int DBCHECK_SHOW_STATS = 8;
/** Fix problems.
*
* Currently this is supported for chert, and will:
*
* * regenerate the "iamchert" file if it isn't valid (so if it is lost,
you
* can just create it empty and then "fix problems").
*
* * regenerate base files (currently the algorithm for finding the root
* block may not work if there was a change partly written but not
* committed).
*
* For use with Xapian::Database::check().
*/
const int DBCHECK_FIX = 16;
} }
#endif /* XAPIAN_INCLUDED_DATABASE_H */ #endif /* XAPIAN_INCLUDED_DATABASE_H */
 End of changes. 17 change blocks. 
11 lines changed or deleted 51 lines changed or added


 dbfactory.h   dbfactory.h 
/** @file dbfactory.h /** @file dbfactory.h
* @brief Factory functions for constructing Database and WritableDatabase objects * @brief Factory functions for constructing Database and WritableDatabase objects
*/ */
/* Copyright (C) 2005,2006,2007,2008,2009,2011 Olly Betts /* Copyright (C) 2005,2006,2007,2008,2009,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_DBFACTORY_H #ifndef XAPIAN_INCLUDED_DBFACTORY_H
#define XAPIAN_INCLUDED_DBFACTORY_H #define XAPIAN_INCLUDED_DBFACTORY_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/dbfactory.h> directly; include <xapian.h> instea
d."
#endif
#ifndef _MSC_VER #ifndef _MSC_VER
# include <sys/types.h> # include <sys/types.h>
#endif #endif
#include <string> #include <string>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/version.h> #include <xapian/version.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 deprecated.h   deprecated.h 
/** @file deprecated.h /** @file deprecated.h
* @brief Define XAPIAN_DEPRECATED() and XAPIAN_DEPRECATED_CLASS macros. * @brief Define XAPIAN_DEPRECATED() and related macros.
*/ */
// Copyright (C) 2006,2007,2009,2011 Olly Betts // Copyright (C) 2006,2007,2009,2011,2012,2013 Olly Betts
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
#ifndef XAPIAN_INCLUDED_DEPRECATED_H #ifndef XAPIAN_INCLUDED_DEPRECATED_H
#define XAPIAN_INCLUDED_DEPRECATED_H #define XAPIAN_INCLUDED_DEPRECATED_H
// How to use of the XAPIAN_DEPRECATED is document in HACKING - see the #if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
// section "Marking Features as Deprecated". Don't forget to update the # error "Never use <xapian/deprecated.h> directly; include <xapian.h> inste
ad."
#endif
// How to make use of XAPIAN_DEPRECATED, etc is documented in HACKING - see
// the section "Marking Features as Deprecated". Don't forget to update th
e
// documentation of deprecated methods for end users in docs/deprecation.rs t // documentation of deprecated methods for end users in docs/deprecation.rs t
// too! // too!
// Don't give deprecation warnings for features marked as externally deprec
ated
// when building the library.
#ifdef XAPIAN_IN_XAPIAN_H
# define XAPIAN_DEPRECATED_EX(D) XAPIAN_DEPRECATED(D)
# define XAPIAN_DEPRECATED_CLASS_EX XAPIAN_DEPRECATED_CLASS
#else
# define XAPIAN_DEPRECATED_EX(D) D
# define XAPIAN_DEPRECATED_CLASS_EX
#endif
// xapian-bindings needs to wrap deprecated functions without warnings, // xapian-bindings needs to wrap deprecated functions without warnings,
// so check if XAPIAN_DEPRECATED is defined so xapian-bindings can override // so check if XAPIAN_DEPRECATED is defined so xapian-bindings can override
// it. // it.
#ifndef XAPIAN_DEPRECATED #ifndef XAPIAN_DEPRECATED
# ifdef __GNUC__ # ifdef __GNUC__
// __attribute__((__deprecated__)) is supported by GCC 3.1 and later, which // __attribute__((__deprecated__)) is supported by GCC 3.1 and later, which
// is now our minimum requirement, so there's no need to check the GCC vers ion // is now our minimum requirement, so there's no need to check the GCC vers ion
// in use. // in use.
# define XAPIAN_DEPRECATED(D) D __attribute__((__deprecated__)) # define XAPIAN_DEPRECATED(D) D __attribute__((__deprecated__))
# define XAPIAN_DEPRECATED_CLASS __attribute__((__deprecated__)) # define XAPIAN_DEPRECATED_CLASS __attribute__((__deprecated__))
 End of changes. 4 change blocks. 
4 lines changed or deleted 21 lines changed or added


 derefwrapper.h   derefwrapper.h 
/** @file derefwrapper.h /** @file derefwrapper.h
* @brief Class for wrapping type returned by an input_iterator. * @brief Class for wrapping type returned by an input_iterator.
*/ */
/* Copyright (C) 2004,2008,2009 Olly Betts /* Copyright (C) 2004,2008,2009,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_DEREFWRAPPER_H #ifndef XAPIAN_INCLUDED_DEREFWRAPPER_H
#define XAPIAN_INCLUDED_DEREFWRAPPER_H #define XAPIAN_INCLUDED_DEREFWRAPPER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/derefwraper.h> directly; include <xapian.h> inst
ead."
#endif
namespace Xapian { namespace Xapian {
/** @private @internal Class which returns a value when dereferenced with /** @private @internal Class which returns a value when dereferenced with
* operator*. * operator*.
* *
* We need this wrapper class to implement input_iterator semantics for th e * We need this wrapper class to implement input_iterator semantics for th e
* postfix operator++ methods of some of our iterator classes. * postfix operator++ methods of some of our iterator classes.
*/ */
template<typename T> template<typename T>
class DerefWrapper_ { class DerefWrapper_ {
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 document.h   document.h 
/** @file document.h /** @file document.h
* @brief API for working with documents * @brief API for working with documents
*/ */
/* Copyright 1999,2000,2001 BrightStation PLC /* Copyright 1999,2000,2001 BrightStation PLC
* Copyright 2002 Ananova Ltd * Copyright 2002 Ananova Ltd
* Copyright 2002,2003,2004,2006,2007,2009,2010,2011 Olly Betts * Copyright 2002,2003,2004,2006,2007,2009,2010,2011,2012,2013 Olly Betts
* Copyright 2009 Lemur Consulting Ltd * Copyright 2009 Lemur Consulting Ltd
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 28 skipping to change at line 28
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_DOCUMENT_H #ifndef XAPIAN_INCLUDED_DOCUMENT_H
#define XAPIAN_INCLUDED_DOCUMENT_H #define XAPIAN_INCLUDED_DOCUMENT_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/document.h> directly; include <xapian.h> instead
."
#endif
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/valueiterator.h> #include <xapian/valueiterator.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/** A handle representing a document in a Xapian database. /** A handle representing a document in a Xapian database.
* *
skipping to change at line 224 skipping to change at line 229
/** The length of the termlist - i.e. the number of different terms /** The length of the termlist - i.e. the number of different terms
* which index this document. * which index this document.
*/ */
Xapian::termcount termlist_count() const; Xapian::termcount termlist_count() const;
/// Iterator for the terms in this document. /// Iterator for the terms in this document.
TermIterator termlist_begin() const; TermIterator termlist_begin() const;
/// Equivalent end iterator for termlist_begin(). /// Equivalent end iterator for termlist_begin().
TermIterator termlist_end() const { TermIterator XAPIAN_NOTHROW(termlist_end() const) {
return TermIterator(); return TermIterator();
} }
/// Count the values in this document. /// Count the values in this document.
Xapian::termcount values_count() const; Xapian::termcount values_count() const;
/// Iterator for the values in this document. /// Iterator for the values in this document.
ValueIterator values_begin() const; ValueIterator values_begin() const;
/// Equivalent end iterator for values_begin(). /// Equivalent end iterator for values_begin().
ValueIterator values_end() const { ValueIterator XAPIAN_NOTHROW(values_end() const) {
return ValueIterator(); return ValueIterator();
} }
/** Get the document id which is associated with this document (if a ny). /** Get the document id which is associated with this document (if a ny).
* *
* NB If multiple databases are being searched together, then this * NB If multiple databases are being searched together, then this
* will be the document id in the individual database, not the merg ed * will be the document id in the individual database, not the merg ed
* database! * database!
* *
* @return If this document came from a database, return the docume nt * @return If this document came from a database, return the docume nt
 End of changes. 5 change blocks. 
3 lines changed or deleted 9 lines changed or added


 enquire.h   enquire.h 
/** @file enquire.h /** @file enquire.h
* @brief API for running queries * @brief API for running queries
*/ */
/* Copyright 1999,2000,2001 BrightStation PLC /* Copyright 1999,2000,2001 BrightStation PLC
* Copyright 2001,2002 Ananova Ltd * Copyright 2001,2002 Ananova Ltd
* Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2011 Olly Betts * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013 Olly Be tts
* Copyright 2009 Lemur Consulting Ltd * Copyright 2009 Lemur Consulting Ltd
* Copyright 2011 Action Without Borders * Copyright 2011 Action Without Borders
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 29 skipping to change at line 29
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_ENQUIRE_H #ifndef XAPIAN_INCLUDED_ENQUIRE_H
#define XAPIAN_INCLUDED_ENQUIRE_H #define XAPIAN_INCLUDED_ENQUIRE_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/enquire.h> directly; include <xapian.h> instead.
"
#endif
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
class Database; class Database;
class Document; class Document;
class ErrorHandler; class ErrorHandler;
skipping to change at line 279 skipping to change at line 284
MSetIterator(Xapian::doccount index_, const MSet & mset_) MSetIterator(Xapian::doccount index_, const MSet & mset_)
: index(index_), mset(mset_) { } : index(index_), mset(mset_) { }
Xapian::doccount index; Xapian::doccount index;
MSet mset; MSet mset;
public: public:
/** Create an uninitialised iterator; this cannot be used, but is /** Create an uninitialised iterator; this cannot be used, but is
* convenient syntactically. * convenient syntactically.
*/ */
MSetIterator() : index(0), mset() { } XAPIAN_NOTHROW(MSetIterator())
: index(0), mset() { }
/// Copying is allowed (and is cheap). /// Copying is allowed (and is cheap).
MSetIterator(const MSetIterator &other) { MSetIterator(const MSetIterator &other) {
index = other.index; index = other.index;
mset = other.mset; mset = other.mset;
} }
/// Assignment is allowed (and is cheap). /// Assignment is allowed (and is cheap).
void operator=(const MSetIterator &other) { void operator=(const MSetIterator &other) {
index = other.index; index = other.index;
skipping to change at line 397 skipping to change at line 403
* However, currently it may get a lower percentage score if you * However, currently it may get a lower percentage score if you
* use a MatchDecider and the sorting is primarily by value. * use a MatchDecider and the sorting is primarily by value.
* In this case, the percentage for a particular document may vary * In this case, the percentage for a particular document may vary
* depending on the first, max_size, and checkatleast parameters * depending on the first, max_size, and checkatleast parameters
* passed to Enquire::get_mset() (this bug is hard to fix without * passed to Enquire::get_mset() (this bug is hard to fix without
* having to apply the MatchDecider to potentially many more * having to apply the MatchDecider to potentially many more
* documents, which is potentially costly). * documents, which is potentially costly).
*/ */
int get_percent() const; int get_percent() const;
/// @private @internal Determine if the iterator has been exhausted.
bool at_end() const { return index == mset.size(); }
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const;
/// Allow use as an STL iterator /// Allow use as an STL iterator
//@{ //@{
typedef std::bidirectional_iterator_tag iterator_category; // FIXME: could enhance to be a randomaccess_iterator typedef std::bidirectional_iterator_tag iterator_category; // FIXME: could enhance to be a randomaccess_iterator
typedef Xapian::docid value_type; typedef Xapian::docid value_type;
typedef Xapian::doccount_diff difference_type; typedef Xapian::doccount_diff difference_type;
typedef Xapian::docid * pointer; typedef Xapian::docid * pointer;
typedef Xapian::docid & reference; typedef Xapian::docid & reference;
skipping to change at line 500 skipping to change at line 509
ESetIterator(Xapian::termcount index_, const ESet & eset_) ESetIterator(Xapian::termcount index_, const ESet & eset_)
: index(index_), eset(eset_) { } : index(index_), eset(eset_) { }
Xapian::termcount index; Xapian::termcount index;
ESet eset; ESet eset;
public: public:
/** Create an uninitialised iterator; this cannot be used, but is /** Create an uninitialised iterator; this cannot be used, but is
* convenient syntactically. * convenient syntactically.
*/ */
ESetIterator() : index(0), eset() { } XAPIAN_NOTHROW(ESetIterator())
: index(0), eset() { }
/// Copying is allowed (and is cheap). /// Copying is allowed (and is cheap).
ESetIterator(const ESetIterator &other) { ESetIterator(const ESetIterator &other) {
index = other.index; index = other.index;
eset = other.eset; eset = other.eset;
} }
/// Assignment is allowed (and is cheap). /// Assignment is allowed (and is cheap).
void operator=(const ESetIterator &other) { void operator=(const ESetIterator &other) {
index = other.index; index = other.index;
eset = other.eset; eset = other.eset;
} }
/// Advance the iterator. /// Advance the iterator.
ESetIterator & operator++() { ESetIterator & XAPIAN_NOTHROW(operator++()) {
++index; ++index;
return *this; return *this;
} }
/// Advance the iterator (postfix variant). /// Advance the iterator (postfix variant).
ESetIterator operator++(int) { ESetIterator operator++(int) {
ESetIterator tmp = *this; ESetIterator tmp = *this;
++index; ++index;
return tmp; return tmp;
} }
/// Decrement the iterator. /// Decrement the iterator.
ESetIterator & operator--() { ESetIterator & XAPIAN_NOTHROW(operator--()) {
--index; --index;
return *this; return *this;
} }
/// Decrement the iterator (postfix variant). /// Decrement the iterator (postfix variant).
ESetIterator operator--(int) { ESetIterator operator--(int) {
ESetIterator tmp = *this; ESetIterator tmp = *this;
--index; --index;
return tmp; return tmp;
} }
/// Get the term for the current position /// Get the term for the current position
const std::string & operator *() const; const std::string & operator *() const;
/// Get the weight of the term at the current position /// Get the weight of the term at the current position
double get_weight() const; double get_weight() const;
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const;
/// @private @internal Determine if the iterator has been exhausted.
bool at_end() const { return index == eset.size(); }
/// Allow use as an STL iterator /// Allow use as an STL iterator
//@{ //@{
typedef std::bidirectional_iterator_tag iterator_category; // FIXME: go for randomaccess_iterator! typedef std::bidirectional_iterator_tag iterator_category; // FIXME: go for randomaccess_iterator!
typedef std::string value_type; typedef std::string value_type;
typedef Xapian::termcount_diff difference_type; typedef Xapian::termcount_diff difference_type;
typedef std::string * pointer; typedef std::string * pointer;
typedef std::string & reference; typedef std::string & reference;
//@} //@}
}; };
bool
XAPIAN_NOTHROW(operator==(const ESetIterator &a, const ESetIterator &b));
/// Equality test for ESetIterator objects. /// Equality test for ESetIterator objects.
inline bool operator==(const ESetIterator &a, const ESetIterator &b) inline bool
operator==(const ESetIterator &a, const ESetIterator &b)
{ {
return (a.index == b.index); return (a.index == b.index);
} }
bool
XAPIAN_NOTHROW(operator!=(const ESetIterator &a, const ESetIterator &b));
/// Inequality test for ESetIterator objects. /// Inequality test for ESetIterator objects.
inline bool operator!=(const ESetIterator &a, const ESetIterator &b) inline bool
operator!=(const ESetIterator &a, const ESetIterator &b)
{ {
return (a.index != b.index); return (a.index != b.index);
} }
/** A relevance set (R-Set). /** A relevance set (R-Set).
* This is the set of documents which are marked as relevant, for use * This is the set of documents which are marked as relevant, for use
* in modifying the term weights, and in performing query expansion. * in modifying the term weights, and in performing query expansion.
*/ */
class XAPIAN_VISIBILITY_DEFAULT RSet { class XAPIAN_VISIBILITY_DEFAULT RSet {
public: public:
skipping to change at line 686 skipping to change at line 707
* @param errorhandler_ A pointer to the error handler to use. * @param errorhandler_ A pointer to the error handler to use.
* Ownership of the object pointed to is not assumed by the * Ownership of the object pointed to is not assumed by the
* Xapian::Enquire object - the user should delete the * Xapian::Enquire object - the user should delete the
* Xapian::ErrorHandler object after the Xapian::Enquire obj ect * Xapian::ErrorHandler object after the Xapian::Enquire obj ect
* is deleted. To use no error handler, this parameter * is deleted. To use no error handler, this parameter
* should be 0. * should be 0.
* *
* @exception Xapian::InvalidArgumentError will be thrown if an * @exception Xapian::InvalidArgumentError will be thrown if an
* empty Database object is supplied. * empty Database object is supplied.
*/ */
explicit Enquire(const Database &database, ErrorHandler * errorhandl explicit Enquire(const Database &database);
er_ = 0); XAPIAN_DEPRECATED_EX(Enquire(const Database &database, ErrorHandler
* errorhandler_));
/** Close the Xapian::Enquire object. /** Close the Xapian::Enquire object.
*/ */
~Enquire(); ~Enquire();
/** Set the query to run. /** Set the query to run.
* *
* @param query the new query to run. * @param query the new query to run.
* @param qlen the query length to use in weight calculations - * @param qlen the query length to use in weight calculations -
* by default the sum of the wqf of all terms is used. * by default the sum of the wqf of all terms is used.
skipping to change at line 903 skipping to change at line 925
* *
* Note that with the default BM25 weighting scheme parameters, * Note that with the default BM25 weighting scheme parameters,
* non-identical documents will rarely have the same weight, so * non-identical documents will rarely have the same weight, so
* this setting will give very similar results to * this setting will give very similar results to
* set_sort_by_relevance(). It becomes more useful with particular * set_sort_by_relevance(). It becomes more useful with particular
* BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom * BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom
* weighting schemes. * weighting schemes.
* *
* @param sort_key value number to sort on. * @param sort_key value number to sort on.
* *
* @param reverse If true, reverses the sort order. * @param reverse If true, reverses the sort order of sort_key.
*/ */
void set_sort_by_relevance_then_value(Xapian::valueno sort_key, void set_sort_by_relevance_then_value(Xapian::valueno sort_key,
bool reverse); bool reverse);
/** Set the sorting to be by relevance, then by keys generated from /** Set the sorting to be by relevance, then by keys generated from
* values. * values.
* *
* Note that with the default BM25 weighting scheme parameters, * Note that with the default BM25 weighting scheme parameters,
* non-identical documents will rarely have the same weight, so * non-identical documents will rarely have the same weight, so
* this setting will give very similar results to * this setting will give very similar results to
* set_sort_by_relevance(). It becomes more useful with particular * set_sort_by_relevance(). It becomes more useful with particular
* BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom * BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom
* weighting schemes. * weighting schemes.
* *
* @param sorter The functor to use for generating keys. * @param sorter The functor to use for generating keys.
* *
* @param reverse If true, reverses the sort order. * @param reverse If true, reverses the sort order of the generate
d
* keys.
*/ */
void set_sort_by_relevance_then_key(Xapian::KeyMaker * sorter, void set_sort_by_relevance_then_key(Xapian::KeyMaker * sorter,
bool reverse); bool reverse);
/** Get (a portion of) the match set for the current query. /** Get (a portion of) the match set for the current query.
* *
* @param first the first item in the result set to return. * @param first the first item in the result set to return.
* A value of zero corresponds to the first item * A value of zero corresponds to the first item
* returned being that with the highest score. * returned being that with the highest score.
* A value of 10 corresponds to the first 10 items * A value of 10 corresponds to the first 10 items
skipping to change at line 1085 skipping to change at line 1108
* in the query. Terms will not occur more than onc e, * in the query. Terms will not occur more than onc e,
* even if they do in the query. * even if they do in the query.
* *
* @exception Xapian::InvalidArgumentError See class documentation . * @exception Xapian::InvalidArgumentError See class documentation .
* @exception Xapian::DocNotFoundError The document specified * @exception Xapian::DocNotFoundError The document specified
* could not be found in the database. * could not be found in the database.
*/ */
TermIterator get_matching_terms_begin(Xapian::docid did) const; TermIterator get_matching_terms_begin(Xapian::docid did) const;
/** End iterator corresponding to get_matching_terms_begin() */ /** End iterator corresponding to get_matching_terms_begin() */
TermIterator get_matching_terms_end(Xapian::docid /*did*/) const { TermIterator XAPIAN_NOTHROW(get_matching_terms_end(Xapian::docid /*d id*/) const) {
return TermIterator(); return TermIterator();
} }
/** Get terms which match a given document, by match set item. /** Get terms which match a given document, by match set item.
* *
* This method returns the terms in the current query which match * This method returns the terms in the current query which match
* the given document. * the given document.
* *
* If the underlying database has suitable support, using this call * If the underlying database has suitable support, using this call
* (rather than passing a Xapian::docid) will enable the system to * (rather than passing a Xapian::docid) will enable the system to
skipping to change at line 1114 skipping to change at line 1137
* in the query. Terms will not occur more than onc e, * in the query. Terms will not occur more than onc e,
* even if they do in the query. * even if they do in the query.
* *
* @exception Xapian::InvalidArgumentError See class documentation . * @exception Xapian::InvalidArgumentError See class documentation .
* @exception Xapian::DocNotFoundError The document specified * @exception Xapian::DocNotFoundError The document specified
* could not be found in the database. * could not be found in the database.
*/ */
TermIterator get_matching_terms_begin(const MSetIterator &it) const; TermIterator get_matching_terms_begin(const MSetIterator &it) const;
/** End iterator corresponding to get_matching_terms_begin() */ /** End iterator corresponding to get_matching_terms_begin() */
TermIterator get_matching_terms_end(const MSetIterator &/*it*/) cons t { TermIterator XAPIAN_NOTHROW(get_matching_terms_end(const MSetIterato r &/*it*/) const) {
return TermIterator(); return TermIterator();
} }
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const;
}; };
} }
#endif /* XAPIAN_INCLUDED_ENQUIRE_H */ #endif /* XAPIAN_INCLUDED_ENQUIRE_H */
 End of changes. 18 change blocks. 
13 lines changed or deleted 38 lines changed or added


 error.h   error.h 
/** @file error.h /** @file error.h
* @brief Hierarchy of classes which Xapian can throw as exceptions. * @brief Hierarchy of classes which Xapian can throw as exceptions.
*/ */
/* Warning: This file is generated by /data/home/olly/tmp/xapian-svn-snapsh ot/tags/1.3.0/xapian/xapian-core/generate-exceptions - do not modify direct ly! */ /* Warning: This file is generated by /data/home/olly/tmp/xapian-svn-snapsh ot/tags/1.3.1/xapian/xapian-core/generate-exceptions - do not modify direct ly! */
/* Copyright (C) 2003,2004,2006,2007,2008,2009,2011 Olly Betts /* Copyright (C) 2003,2004,2006,2007,2008,2009,2011 Olly Betts
* Copyright (C) 2007 Richard Boulton * Copyright (C) 2007 Richard Boulton
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 26 skipping to change at line 26
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_ERROR_H #ifndef XAPIAN_INCLUDED_ERROR_H
#define XAPIAN_INCLUDED_ERROR_H #define XAPIAN_INCLUDED_ERROR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/error.h> directly; include <xapian.h> instead."
#endif
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
class ErrorHandler; class ErrorHandler;
/** All exceptions thrown by Xapian are subclasses of Xapian::Error. /** All exceptions thrown by Xapian are subclasses of Xapian::Error.
* *
* This class can not be instantiated directly - instead a subclass should * This class can not be instantiated directly - instead a subclass should
* be used. * be used.
skipping to change at line 101 skipping to change at line 106
/** @private @internal /** @private @internal
* @brief Constructor for use by constructors of derived classes. * @brief Constructor for use by constructors of derived classes.
*/ */
Error(const std::string &msg_, const std::string &context_, Error(const std::string &msg_, const std::string &context_,
const char * type_, int errno_) const char * type_, int errno_)
: msg(msg_), context(context_), error_string(), type(type_), : msg(msg_), context(context_), error_string(), type(type_),
my_errno(errno_), already_handled(false) { } my_errno(errno_), already_handled(false) { }
public: public:
/// The type of this error (e.g. "DocNotFoundError".) /// The type of this error (e.g. "DocNotFoundError".)
const char * get_type() const { return type + 1; } const char * XAPIAN_NOTHROW(get_type() const) XAPIAN_PURE_FUNCTION {
return type + 1;
}
/// Message giving details of the error, intended for human consumption . /// Message giving details of the error, intended for human consumption .
const std::string & get_msg() const { return msg; } const std::string & XAPIAN_NOTHROW(get_msg() const) XAPIAN_PURE_FUNCTIO
N {
return msg;
}
/** Optional context information. /** Optional context information.
* *
* This context is intended for use by Xapian::ErrorHandler (for examp le * This context is intended for use by Xapian::ErrorHandler (for examp le
* so it can know which remote server is unreliable and report the pro blem * so it can know which remote server is unreliable and report the pro blem
* and remove that server from those being searched). But it's typica lly * and remove that server from those being searched). But it's typica lly
* a plain-text string, and so also fit for human consumption. * a plain-text string, and so also fit for human consumption.
*/ */
const std::string & get_context() const { return context; } const std::string & XAPIAN_NOTHROW(get_context() const) XAPIAN_PURE_FUN
CTION
{
return context;
}
/** Returns any system error string associated with this exception. /** Returns any system error string associated with this exception.
* *
* The system error string may come from errno, h_errno (on UNIX), or * The system error string may come from errno, h_errno (on UNIX), or
* GetLastError() (on MS Windows). If there is no associated system * GetLastError() (on MS Windows). If there is no associated system
* error string, NULL is returned. * error string, NULL is returned.
*/ */
const char * get_error_string() const; const char * get_error_string() const XAPIAN_PURE_FUNCTION;
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const;
}; };
/** The base class for exceptions indicating errors in the program logic. /** The base class for exceptions indicating errors in the program logic.
* *
* A subclass of LogicError will be thrown if Xapian detects a violation * A subclass of LogicError will be thrown if Xapian detects a violation
* of a class invariant or a logical precondition or postcondition, etc. * of a class invariant or a logical precondition or postcondition, etc.
*/ */
 End of changes. 7 change blocks. 
5 lines changed or deleted 19 lines changed or added


 errorhandler.h   errorhandler.h 
/** @file errorhandler.h /** @file errorhandler.h
* @brief Decide if a Xapian::Error exception should be ignored. * @brief Decide if a Xapian::Error exception should be ignored.
*/ */
/* Copyright (C) 2003,2006,2007 Olly Betts /* Copyright (C) 2003,2006,2007,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_ERRORHANDLER_H #ifndef XAPIAN_INCLUDED_ERRORHANDLER_H
#define XAPIAN_INCLUDED_ERRORHANDLER_H #define XAPIAN_INCLUDED_ERRORHANDLER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/errorhandler.h> directly; include <xapian.h> ins
tead."
#endif
#include <xapian/attributes.h>
#include <xapian/deprecated.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
class Error; class Error;
/** Decide if a Xapian::Error exception should be ignored. /** Decide if a Xapian::Error exception should be ignored.
* *
* You can create your own subclass of this class and pass in an instance * You can create your own subclass of this class and pass in an instance
* of it when you construct a Xapian::Enquire object. Xapian::Error * of it when you construct a Xapian::Enquire object. Xapian::Error
skipping to change at line 69 skipping to change at line 75
* Note that it's not always possible to continue execution, so * Note that it's not always possible to continue execution, so
* the error may be rethrown even if you return true. The ErrorHandle r * the error may be rethrown even if you return true. The ErrorHandle r
* is still called in this situation as you may want to log that a * is still called in this situation as you may want to log that a
* particular remote backend server isn't responding, and perhaps * particular remote backend server isn't responding, and perhaps
* remove it from those being searched temporarily. * remove it from those being searched temporarily.
* *
* @param error The Xapian::Error object under consideration. * @param error The Xapian::Error object under consideration.
* *
* @return true to attempt to continue; false to rethrow the error. * @return true to attempt to continue; false to rethrow the error.
*/ */
virtual bool handle_error(Xapian::Error &error) = 0; XAPIAN_DEPRECATED_EX(virtual bool handle_error(Xapian::Error &error)) = 0;
public: public:
/// Default constructor. /// Default constructor.
ErrorHandler() {} XAPIAN_NOTHROW(ErrorHandler()) {}
/// We require a virtual destructor because we have virtual methods. /// We require a virtual destructor because we have virtual methods.
virtual ~ErrorHandler(); virtual ~ErrorHandler();
/** Handle a Xapian::Error object. /** Handle a Xapian::Error object.
* *
* This method is called when a Xapian::Error object is thrown and * This method is called when a Xapian::Error object is thrown and
* caught inside Enquire. If this is the first ErrorHandler that * caught inside Enquire. If this is the first ErrorHandler that
* the Error has been passed to, then the handle_error() virtual * the Error has been passed to, then the handle_error() virtual
* method is called, which allows the API user to decide how to * method is called, which allows the API user to decide how to
 End of changes. 4 change blocks. 
3 lines changed or deleted 10 lines changed or added


 expanddecider.h   expanddecider.h 
/** @file expanddecider.h /** @file expanddecider.h
* @brief Allow rejection of terms during ESet generation. * @brief Allow rejection of terms during ESet generation.
*/ */
/* Copyright (C) 2007,2011 Olly Betts /* Copyright (C) 2007,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_EXPANDDECIDER_H #ifndef XAPIAN_INCLUDED_EXPANDDECIDER_H
#define XAPIAN_INCLUDED_EXPANDDECIDER_H #define XAPIAN_INCLUDED_EXPANDDECIDER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/expanddecider.h> directly; include <xapian.h> in
stead."
#endif
#include <set> #include <set>
#include <string> #include <string>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/** Virtual base class for expand decider functor. */ /** Virtual base class for expand decider functor. */
class XAPIAN_VISIBILITY_DEFAULT ExpandDecider { class XAPIAN_VISIBILITY_DEFAULT ExpandDecider {
public: public:
skipping to change at line 99 skipping to change at line 103
* TermIterator or char **). * TermIterator or char **).
* @param reject_end End iterator for the list of terms to reject . * @param reject_end End iterator for the list of terms to reject .
*/ */
template <class Iterator> template <class Iterator>
ExpandDeciderFilterTerms(Iterator reject_begin, Iterator reject_end) ExpandDeciderFilterTerms(Iterator reject_begin, Iterator reject_end)
: rejects(reject_begin, reject_end) { } : rejects(reject_begin, reject_end) { }
virtual bool operator()(const std::string &term) const; virtual bool operator()(const std::string &term) const;
}; };
/** ExpandDecider subclass which restrict terms to a particular prefix
*
* ExpandDeciderFilterPrefix provides an easy way to choose terms with a
* particular prefix when generating an ESet.
*/
class XAPIAN_VISIBILITY_DEFAULT ExpandDeciderFilterPrefix : public ExpandDe
cider {
std::string prefix;
public:
/** The parameter specify the prefix of terms to be retained
* @param prefix_ restrict terms to the particular prefix_
*/
ExpandDeciderFilterPrefix(const std::string &prefix_)
: prefix(prefix_) { }
virtual bool operator() (const std::string &term) const;
};
} }
#endif // XAPIAN_INCLUDED_EXPANDDECIDER_H #endif // XAPIAN_INCLUDED_EXPANDDECIDER_H
 End of changes. 3 change blocks. 
1 lines changed or deleted 25 lines changed or added


 geospatial.h   geospatial.h 
/** @file geospatial.h /** @file geospatial.h
* @brief Geospatial search support routines. * @brief Geospatial search support routines.
*/ */
/* Copyright 2008,2009 Lemur Consulting Ltd /* Copyright 2008,2009 Lemur Consulting Ltd
* Copyright 2010,2011 Richard Boulton * Copyright 2010,2011 Richard Boulton
* Copyright 2012 Olly Betts * Copyright 2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_GEOSPATIAL_H #ifndef XAPIAN_INCLUDED_GEOSPATIAL_H
#define XAPIAN_INCLUDED_GEOSPATIAL_H #define XAPIAN_INCLUDED_GEOSPATIAL_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/geospatial.h> directly; include <xapian.h> inste
ad."
#endif
#include <iterator> #include <iterator>
#include <vector> #include <vector>
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/derefwrapper.h> #include <xapian/derefwrapper.h>
#include <xapian/keymaker.h> #include <xapian/keymaker.h>
#include <xapian/postingsource.h> #include <xapian/postingsource.h>
#include <xapian/queryparser.h> // For sortable_serialise #include <xapian/queryparser.h> // For sortable_serialise
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
class Registry; class Registry;
double
XAPIAN_NOTHROW(miles_to_metres(double miles)) XAPIAN_CONST_FUNCTION;
/** Convert from miles to metres. /** Convert from miles to metres.
* *
* Experimental - see http://xapian.org/docs/deprecation#experimental-feat ures * Experimental - see http://xapian.org/docs/deprecation#experimental-feat ures
*/ */
inline double inline double
miles_to_metres(double miles) miles_to_metres(double miles)
{ {
return 1609.344 * miles; return 1609.344 * miles;
} }
double
XAPIAN_NOTHROW(metres_to_miles(double metres)) XAPIAN_CONST_FUNCTION;
/** Convert from metres to miles. /** Convert from metres to miles.
* *
* Experimental - see http://xapian.org/docs/deprecation#experimental-feat ures * Experimental - see http://xapian.org/docs/deprecation#experimental-feat ures
*/ */
inline double inline double
metres_to_miles(double metres) metres_to_miles(double metres)
{ {
return metres * (1.0 / 1609.344); return metres * (1.0 / 1609.344);
} }
skipping to change at line 91 skipping to change at line 102
* Will be wrapped around, so for example, -150 is equal to 210. When * Will be wrapped around, so for example, -150 is equal to 210. When
* obtained from a serialised form, will be in the range 0 <= longitud e < * obtained from a serialised form, will be in the range 0 <= longitud e <
* 360. * 360.
* *
* Longitudes increase as coordinates move eastwards. * Longitudes increase as coordinates move eastwards.
*/ */
double longitude; double longitude;
/** Construct an uninitialised coordinate. /** Construct an uninitialised coordinate.
*/ */
LatLongCoord() {} XAPIAN_NOTHROW(LatLongCoord()) {}
/** Construct a coordinate. /** Construct a coordinate.
* *
* If the supplied longitude is out of the standard range, it will be * If the supplied longitude is out of the standard range, it will be
* normalised to the range 0 <= longitude < 360. * normalised to the range 0 <= longitude < 360.
* *
* If you want to avoid the checks (for example, you know that your va lues * If you want to avoid the checks (for example, you know that your va lues
* are already in range), you can use the alternate constructor to * are already in range), you can use the alternate constructor to
* construct an uninitialised coordinate, and then set the latitude an d * construct an uninitialised coordinate, and then set the latitude an d
* longitude directly. * longitude directly.
skipping to change at line 136 skipping to change at line 147
* a valid serialised latitude-longitude pair. * a valid serialised latitude-longitude pair.
*/ */
void unserialise(const char ** ptr, const char * end); void unserialise(const char ** ptr, const char * end);
/** Return a serialised representation of the coordinate. /** Return a serialised representation of the coordinate.
*/ */
std::string serialise() const; std::string serialise() const;
/** Compare with another LatLongCoord. /** Compare with another LatLongCoord.
*/ */
bool operator<(const LatLongCoord & other) const bool XAPIAN_NOTHROW(operator<(const LatLongCoord & other) const)
{ {
if (latitude < other.latitude) return true; if (latitude < other.latitude) return true;
if (latitude > other.latitude) return false; if (latitude > other.latitude) return false;
return (longitude < other.longitude); return (longitude < other.longitude);
} }
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const;
}; };
 End of changes. 7 change blocks. 
3 lines changed or deleted 15 lines changed or added


 intrusive_ptr.h   intrusive_ptr.h 
#ifndef XAPIAN_INCLUDED_INTRUSIVE_PTR_H #ifndef XAPIAN_INCLUDED_INTRUSIVE_PTR_H
#define XAPIAN_INCLUDED_INTRUSIVE_PTR_H #define XAPIAN_INCLUDED_INTRUSIVE_PTR_H
// //
// Based on Boost's intrusive_ptr.hpp // Based on Boost's intrusive_ptr.hpp
// //
// Copyright (c) 2001, 2002 Peter Dimov // Copyright (c) 2001, 2002 Peter Dimov
// Copyright (c) 2011 Olly Betts // Copyright (c) 2011, 2013 Olly Betts
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// //
// Boost Software License - Version 1.0 - August 17th, 2003 // Boost Software License - Version 1.0 - August 17th, 2003
// //
// Permission is hereby granted, free of charge, to any person or organizat ion // Permission is hereby granted, free of charge, to any person or organizat ion
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of t he // execute, and transmit the Software, and to prepare derivative works of t he
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
skipping to change at line 39 skipping to change at line 39
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for document ation. // See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for document ation.
// //
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/intrusive_ptr.h> directly; include <xapian.h> in
stead."
#endif
namespace Xapian { namespace Xapian {
namespace Internal { namespace Internal {
/// Base class for objects managed by intrusive_ptr. /// Base class for objects managed by intrusive_ptr.
class intrusive_base { class intrusive_base {
/// Prevent copying. /// Prevent copying.
intrusive_base(const intrusive_base&); intrusive_base(const intrusive_base&);
/// Prevent assignment. /// Prevent assignment.
void operator=(const intrusive_base&); void operator=(const intrusive_base&);
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 keymaker.h   keymaker.h 
/** @file keymaker.h /** @file keymaker.h
* @brief Build key strings for MSet ordering or collapsing. * @brief Build key strings for MSet ordering or collapsing.
*/ */
/* Copyright (C) 2007,2009,2011 Olly Betts /* Copyright (C) 2007,2009,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_KEYMAKER_H #ifndef XAPIAN_INCLUDED_KEYMAKER_H
#define XAPIAN_INCLUDED_KEYMAKER_H #define XAPIAN_INCLUDED_KEYMAKER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/keymaker.h> directly; include <xapian.h> instead
."
#endif
#include <string> #include <string>
#include <vector> #include <vector>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
class Document; class Document;
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 matchspy.h   matchspy.h 
/** @file matchspy.h /** @file matchspy.h
* @brief MatchSpy implementation. * @brief MatchSpy implementation.
*/ */
/* Copyright (C) 2007,2008,2009,2010,2011,2012 Olly Betts /* Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Olly Betts
* Copyright (C) 2007,2009 Lemur Consulting Ltd * Copyright (C) 2007,2009 Lemur Consulting Ltd
* Copyright (C) 2010 Richard Boulton * Copyright (C) 2010 Richard Boulton
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 26 skipping to change at line 26
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_MATCHSPY_H #ifndef XAPIAN_INCLUDED_MATCHSPY_H
#define XAPIAN_INCLUDED_MATCHSPY_H #define XAPIAN_INCLUDED_MATCHSPY_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/matchspy.h> directly; include <xapian.h> instead
."
#endif
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
#include <map> #include <map>
namespace Xapian { namespace Xapian {
class Document; class Document;
skipping to change at line 54 skipping to change at line 59
class XAPIAN_VISIBILITY_DEFAULT MatchSpy { class XAPIAN_VISIBILITY_DEFAULT MatchSpy {
private: private:
/// Don't allow assignment. /// Don't allow assignment.
void operator=(const MatchSpy &); void operator=(const MatchSpy &);
/// Don't allow copying. /// Don't allow copying.
MatchSpy(const MatchSpy &); MatchSpy(const MatchSpy &);
protected: protected:
/// Default constructor, needed by subclass constructors. /// Default constructor, needed by subclass constructors.
MatchSpy() {} XAPIAN_NOTHROW(MatchSpy()) {}
public: public:
/** Virtual destructor, because we have virtual methods. */ /** Virtual destructor, because we have virtual methods. */
virtual ~MatchSpy(); virtual ~MatchSpy();
/** Register a document with the match spy. /** Register a document with the match spy.
* *
* This is called by the matcher once with each document seen by the * This is called by the matcher once with each document seen by the
* matcher during the match process. Note that the matcher will often not * matcher during the match process. Note that the matcher will often not
* see all the documents which match the query, due to optimisations w hich * see all the documents which match the query, due to optimisations w hich
skipping to change at line 209 skipping to change at line 214
public: public:
/// Construct an empty ValueCountMatchSpy. /// Construct an empty ValueCountMatchSpy.
ValueCountMatchSpy() : internal() {} ValueCountMatchSpy() : internal() {}
/// Construct a MatchSpy which counts the values in a particular slot. /// Construct a MatchSpy which counts the values in a particular slot.
ValueCountMatchSpy(Xapian::valueno slot_) ValueCountMatchSpy(Xapian::valueno slot_)
: internal(new Internal(slot_)) {} : internal(new Internal(slot_)) {}
/** Return the total number of documents tallied. */ /** Return the total number of documents tallied. */
size_t get_total() const { size_t XAPIAN_NOTHROW(get_total() const) {
return internal->total; return internal->total;
} }
/** Get an iterator over the values seen in the slot. /** Get an iterator over the values seen in the slot.
* *
* Items will be returned in ascending alphabetical order. * Items will be returned in ascending alphabetical order.
* *
* During the iteration, the frequency of the current value can be * During the iteration, the frequency of the current value can be
* obtained with the get_termfreq() method on the iterator. * obtained with the get_termfreq() method on the iterator.
*/ */
TermIterator values_begin() const; TermIterator values_begin() const;
/** End iterator corresponding to values_begin() */ /** End iterator corresponding to values_begin() */
TermIterator values_end() const { TermIterator XAPIAN_NOTHROW(values_end() const) {
return TermIterator(); return TermIterator();
} }
/** Get an iterator over the most frequent values seen in the slot. /** Get an iterator over the most frequent values seen in the slot.
* *
* Items will be returned in descending order of frequency. Values wi th * Items will be returned in descending order of frequency. Values wi th
* the same frequency will be returned in ascending alphabetical order . * the same frequency will be returned in ascending alphabetical order .
* *
* During the iteration, the frequency of the current value can be * During the iteration, the frequency of the current value can be
* obtained with the get_termfreq() method on the iterator. * obtained with the get_termfreq() method on the iterator.
* *
* @param maxvalues The maximum number of values to return. * @param maxvalues The maximum number of values to return.
*/ */
TermIterator top_values_begin(size_t maxvalues) const; TermIterator top_values_begin(size_t maxvalues) const;
/** End iterator corresponding to top_values_begin() */ /** End iterator corresponding to top_values_begin() */
TermIterator top_values_end(size_t) const { TermIterator XAPIAN_NOTHROW(top_values_end(size_t) const) {
return TermIterator(); return TermIterator();
} }
/** Implementation of virtual operator(). /** Implementation of virtual operator().
* *
* This implementation tallies values for a matching document. * This implementation tallies values for a matching document.
* *
* @param doc The document to tally values for. * @param doc The document to tally values for.
* @param wt The weight of the document (ignored by this class). * @param wt The weight of the document (ignored by this class).
*/ */
 End of changes. 6 change blocks. 
5 lines changed or deleted 11 lines changed or added


 positioniterator.h   positioniterator.h 
/** @file positioniterator.h /** @file positioniterator.h
* @brief Class for iterating over term positions. * @brief Class for iterating over term positions.
*/ */
/* Copyright (C) 2008,2009,2010,2011 Olly Betts /* Copyright (C) 2008,2009,2010,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_POSITIONITERATOR_H #ifndef XAPIAN_INCLUDED_POSITIONITERATOR_H
#define XAPIAN_INCLUDED_POSITIONITERATOR_H #define XAPIAN_INCLUDED_POSITIONITERATOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/positioniterator.h> directly; include <xapian.h>
instead."
#endif
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/derefwrapper.h> #include <xapian/derefwrapper.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/// Class for iterating over term positions. /// Class for iterating over term positions.
class XAPIAN_VISIBILITY_DEFAULT PositionIterator { class XAPIAN_VISIBILITY_DEFAULT PositionIterator {
void decref(); void decref();
skipping to change at line 58 skipping to change at line 63
PositionIterator(const PositionIterator & o); PositionIterator(const PositionIterator & o);
/// Assignment. /// Assignment.
PositionIterator & operator=(const PositionIterator & o); PositionIterator & operator=(const PositionIterator & o);
/** Default constructor. /** Default constructor.
* *
* Creates an uninitialised iterator, which can't be used before being * Creates an uninitialised iterator, which can't be used before being
* assigned to, but is sometimes syntactically convenient. * assigned to, but is sometimes syntactically convenient.
*/ */
PositionIterator() : internal(0) { } XAPIAN_NOTHROW(PositionIterator())
: internal(0) { }
/// Destructor. /// Destructor.
~PositionIterator() { ~PositionIterator() {
if (internal) decref(); if (internal) decref();
} }
/// Return the term position at the current iterator position. /// Return the term position at the current iterator position.
Xapian::termpos operator*() const; Xapian::termpos operator*() const;
/// Advance the iterator to the next position. /// Advance the iterator to the next position.
skipping to change at line 113 skipping to change at line 119
typedef Xapian::termpos value_type; typedef Xapian::termpos value_type;
/// @private /// @private
typedef Xapian::termpos_diff difference_type; typedef Xapian::termpos_diff difference_type;
/// @private /// @private
typedef Xapian::termpos * pointer; typedef Xapian::termpos * pointer;
/// @private /// @private
typedef Xapian::termpos & reference; typedef Xapian::termpos & reference;
// @} // @}
}; };
bool
XAPIAN_NOTHROW(operator==(const PositionIterator &a, const PositionIterator
&b));
/// Equality test for PositionIterator objects. /// Equality test for PositionIterator objects.
inline bool inline bool
operator==(const PositionIterator &a, const PositionIterator &b) operator==(const PositionIterator &a, const PositionIterator &b)
{ {
// Use a pointer comparison - this ensures both that (a == a) and corre ct // Use a pointer comparison - this ensures both that (a == a) and corre ct
// handling of end iterators (which we ensure have NULL internals). // handling of end iterators (which we ensure have NULL internals).
return a.internal == b.internal; return a.internal == b.internal;
} }
bool
XAPIAN_NOTHROW(operator!=(const PositionIterator &a, const PositionIterator
&b));
/// Inequality test for PositionIterator objects. /// Inequality test for PositionIterator objects.
inline bool inline bool
operator!=(const PositionIterator &a, const PositionIterator &b) operator!=(const PositionIterator &a, const PositionIterator &b)
{ {
return !(a == b); return !(a == b);
} }
} }
#endif // XAPIAN_INCLUDED_POSITIONITERATOR_H #endif // XAPIAN_INCLUDED_POSITIONITERATOR_H
 End of changes. 6 change blocks. 
2 lines changed or deleted 17 lines changed or added


 postingiterator.h   postingiterator.h 
/** @file postingiterator.h /** @file postingiterator.h
* @brief Class for iterating over a list of document ids * @brief Class for iterating over a list of document ids
*/ */
/* Copyright (C) 2007,2008,2009,2010,2011 Olly Betts /* Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_POSTINGITERATOR_H #ifndef XAPIAN_INCLUDED_POSTINGITERATOR_H
#define XAPIAN_INCLUDED_POSTINGITERATOR_H #define XAPIAN_INCLUDED_POSTINGITERATOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/postingiterator.h> directly; include <xapian.h>
instead."
#endif
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/derefwrapper.h> #include <xapian/derefwrapper.h>
#include <xapian/positioniterator.h> #include <xapian/positioniterator.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/// Class for iterating over a list of terms. /// Class for iterating over a list of terms.
class XAPIAN_VISIBILITY_DEFAULT PostingIterator { class XAPIAN_VISIBILITY_DEFAULT PostingIterator {
public: public:
skipping to change at line 57 skipping to change at line 62
PostingIterator(const PostingIterator & o); PostingIterator(const PostingIterator & o);
/// Assignment. /// Assignment.
PostingIterator & operator=(const PostingIterator & o); PostingIterator & operator=(const PostingIterator & o);
/** Default constructor. /** Default constructor.
* *
* Creates an uninitialised iterator, which can't be used before being * Creates an uninitialised iterator, which can't be used before being
* assigned to, but is sometimes syntactically convenient. * assigned to, but is sometimes syntactically convenient.
*/ */
PostingIterator() : internal(0) { } XAPIAN_NOTHROW(PostingIterator())
: internal(0) { }
/// Destructor. /// Destructor.
~PostingIterator() { ~PostingIterator() {
if (internal) decref(); if (internal) decref();
} }
/// Return the document id at the current position. /// Return the document id at the current position.
Xapian::docid operator*() const; Xapian::docid operator*() const;
/// Return the wdf for the document at the current position. /// Return the wdf for the document at the current position.
skipping to change at line 82 skipping to change at line 88
#if 0 // FIXME: TermIterator supports this, so PostingIterator really ought to. #if 0 // FIXME: TermIterator supports this, so PostingIterator really ought to.
/// Return the length of the position list for the current position. /// Return the length of the position list for the current position.
Xapian::termcount positionlist_count() const; Xapian::termcount positionlist_count() const;
#endif #endif
/// Return a PositionIterator for the current document. /// Return a PositionIterator for the current document.
PositionIterator positionlist_begin() const; PositionIterator positionlist_begin() const;
/// Return an end PositionIterator for the current document. /// Return an end PositionIterator for the current document.
PositionIterator positionlist_end() const { PositionIterator XAPIAN_NOTHROW(positionlist_end() const) {
return PositionIterator(); return PositionIterator();
} }
/// Advance the iterator to the next position. /// Advance the iterator to the next position.
PostingIterator & operator++(); PostingIterator & operator++();
/// Advance the iterator to the next position (postfix version). /// Advance the iterator to the next position (postfix version).
DerefWrapper_<Xapian::docid> operator++(int) { DerefWrapper_<Xapian::docid> operator++(int) {
Xapian::docid did(**this); Xapian::docid did(**this);
operator++(); operator++();
skipping to change at line 136 skipping to change at line 142
/// @private /// @private
typedef Xapian::docid & reference; typedef Xapian::docid & reference;
// @} // @}
private: private:
void decref(); void decref();
void post_advance(Internal * res); void post_advance(Internal * res);
}; };
bool
XAPIAN_NOTHROW(operator==(const PostingIterator &a, const PostingIterator &
b));
/// Equality test for PostingIterator objects. /// Equality test for PostingIterator objects.
inline bool inline bool
operator==(const PostingIterator &a, const PostingIterator &b) operator==(const PostingIterator &a, const PostingIterator &b)
{ {
// Use a pointer comparison - this ensures both that (a == a) and corre ct // Use a pointer comparison - this ensures both that (a == a) and corre ct
// handling of end iterators (which we ensure have NULL internals). // handling of end iterators (which we ensure have NULL internals).
return a.internal == b.internal; return a.internal == b.internal;
} }
inline bool
XAPIAN_NOTHROW(operator!=(const PostingIterator &a, const PostingIterator &
b));
/// Inequality test for PostingIterator objects. /// Inequality test for PostingIterator objects.
inline bool inline bool
operator!=(const PostingIterator &a, const PostingIterator &b) operator!=(const PostingIterator &a, const PostingIterator &b)
{ {
return !(a == b); return !(a == b);
} }
} }
#endif // XAPIAN_INCLUDED_POSTINGITERATOR_H #endif // XAPIAN_INCLUDED_POSTINGITERATOR_H
 End of changes. 7 change blocks. 
3 lines changed or deleted 18 lines changed or added


 postingsource.h   postingsource.h 
/** @file postingsource.h /** @file postingsource.h
* @brief External sources of posting information * @brief External sources of posting information
*/ */
/* Copyright (C) 2007,2008,2009,2010,2011,2012 Olly Betts /* Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Olly Betts
* Copyright (C) 2008,2009 Lemur Consulting Ltd * Copyright (C) 2008,2009 Lemur Consulting Ltd
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_POSTINGSOURCE_H #ifndef XAPIAN_INCLUDED_POSTINGSOURCE_H
#define XAPIAN_INCLUDED_POSTINGSOURCE_H #define XAPIAN_INCLUDED_POSTINGSOURCE_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/postingsource.h> directly; include <xapian.h> in
stead."
#endif
#include <xapian/attributes.h>
#include <xapian/database.h> #include <xapian/database.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
#include <map> #include <map>
namespace Xapian { namespace Xapian {
class Registry; class Registry;
skipping to change at line 57 skipping to change at line 62
/** The object to inform of maxweight changes. /** The object to inform of maxweight changes.
* *
* We store this as a (void*) to avoid needing to declare an internal * We store this as a (void*) to avoid needing to declare an internal
* type in an external header. It's actually (MultiMatch *). * type in an external header. It's actually (MultiMatch *).
*/ */
void * matcher_; void * matcher_;
protected: protected:
/// Allow subclasses to be instantiated. /// Allow subclasses to be instantiated.
PostingSource() : max_weight_(0), matcher_(NULL) { } XAPIAN_NOTHROW(PostingSource())
: max_weight_(0), matcher_(NULL) { }
/** Set an upper bound on what get_weight() can return from now on. /** Set an upper bound on what get_weight() can return from now on.
* *
* This upper bound is used by the matcher to perform various * This upper bound is used by the matcher to perform various
* optimisations, so if you can return a good bound, then matches * optimisations, so if you can return a good bound, then matches
* will generally run faster. * will generally run faster.
* *
* This method should be called after calling init(), and may be calle d * This method should be called after calling init(), and may be calle d
* during iteration if the upper bound drops. * during iteration if the upper bound drops.
* *
skipping to change at line 98 skipping to change at line 104
void register_matcher_(void * matcher) { matcher_ = matcher; } void register_matcher_(void * matcher) { matcher_ = matcher; }
// Destructor. // Destructor.
virtual ~PostingSource(); virtual ~PostingSource();
/** A lower bound on the number of documents this object can return. /** A lower bound on the number of documents this object can return.
* *
* Xapian will always call init() on a PostingSource before calling th is * Xapian will always call init() on a PostingSource before calling th is
* for the first time. * for the first time.
*/ */
virtual Xapian::doccount get_termfreq_min() const = 0; virtual Xapian::doccount get_termfreq_min() const XAPIAN_PURE_FUNCTION = 0;
/** An estimate of the number of documents this object can return. /** An estimate of the number of documents this object can return.
* *
* It must always be true that: * It must always be true that:
* *
* get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max() * get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max()
* *
* Xapian will always call init() on a PostingSource before calling th is * Xapian will always call init() on a PostingSource before calling th is
* for the first time. * for the first time.
*/ */
virtual Xapian::doccount get_termfreq_est() const = 0; virtual Xapian::doccount get_termfreq_est() const XAPIAN_PURE_FUNCTION = 0;
/** An upper bound on the number of documents this object can return. /** An upper bound on the number of documents this object can return.
* *
* Xapian will always call init() on a PostingSource before calling th is * Xapian will always call init() on a PostingSource before calling th is
* for the first time. * for the first time.
*/ */
virtual Xapian::doccount get_termfreq_max() const = 0; virtual Xapian::doccount get_termfreq_max() const XAPIAN_PURE_FUNCTION = 0;
/// Return the currently set upper bound on what get_weight() can retur n. /// Return the currently set upper bound on what get_weight() can retur n.
double get_maxweight() const { return max_weight_; } double XAPIAN_NOTHROW(get_maxweight() const) { return max_weight_; }
/** Return the weight contribution for the current document. /** Return the weight contribution for the current document.
* *
* This default implementation always returns 0, for convenience when * This default implementation always returns 0, for convenience when
* implementing "weight-less" PostingSource subclasses. * implementing "weight-less" PostingSource subclasses.
* *
* This method may assume that it will only be called when there is a * This method may assume that it will only be called when there is a
* "current document". In detail: Xapian will always call init() on a * "current document". In detail: Xapian will always call init() on a
* PostingSource before calling this for the first time. It will also * PostingSource before calling this for the first time. It will also
* only call this if the PostingSource reports that it is pointing to a * only call this if the PostingSource reports that it is pointing to a
* valid document (ie, it will not call it before calling at least one of * valid document (ie, it will not call it before calling at least one of
* next(), skip_to() or check(), and will ensure that the PostingSourc e is * next(), skip_to() or check(), and will ensure that the PostingSourc e is
* not at the end by calling at_end()). * not at the end by calling at_end()).
*/ */
virtual double get_weight() const; virtual double get_weight() const XAPIAN_PURE_FUNCTION;
/** Return the current docid. /** Return the current docid.
* *
* This method may assume that it will only be called when there is a * This method may assume that it will only be called when there is a
* "current document". See @a get_weight() for details. * "current document". See @a get_weight() for details.
* *
* Note: in the case of a multi-database search, the returned docid sh ould * Note: in the case of a multi-database search, the returned docid sh ould
* be in the single subdatabase relevant to this posting source. See the * be in the single subdatabase relevant to this posting source. See the
* @a init() method for details. * @a init() method for details.
*/ */
virtual Xapian::docid get_docid() const = 0; virtual Xapian::docid get_docid() const XAPIAN_PURE_FUNCTION = 0;
/** Advance the current position to the next matching document. /** Advance the current position to the next matching document.
* *
* The PostingSource starts before the first entry in the list, so nex t() * The PostingSource starts before the first entry in the list, so nex t()
* must be called before any methods which need the context of * must be called before any methods which need the context of
* the current position. * the current position.
* *
* Xapian will always call init() on a PostingSource before calling th is * Xapian will always call init() on a PostingSource before calling th is
* for the first time. * for the first time.
* *
skipping to change at line 232 skipping to change at line 238
* @param min_wt The minimum weight contribution that is needed (this is * @param min_wt The minimum weight contribution that is needed (this is
* just a hint which subclasses may ignore). * just a hint which subclasses may ignore).
*/ */
virtual bool check(Xapian::docid did, double min_wt); virtual bool check(Xapian::docid did, double min_wt);
/** Return true if the current position is past the last entry in this list. /** Return true if the current position is past the last entry in this list.
* *
* At least one of @a next(), @a skip_to() or @a check() will be calle d * At least one of @a next(), @a skip_to() or @a check() will be calle d
* before this method is first called. * before this method is first called.
*/ */
virtual bool at_end() const = 0; virtual bool at_end() const XAPIAN_PURE_FUNCTION = 0;
/** Clone the posting source. /** Clone the posting source.
* *
* The clone should inherit the configuration of the parent, but need not * The clone should inherit the configuration of the parent, but need not
* inherit the state. ie, the clone does not need to be in the same * inherit the state. ie, the clone does not need to be in the same
* iteration position as the original: the matcher will always call * iteration position as the original: the matcher will always call
* init() on the clone before attempting to move the iterator, or read * init() on the clone before attempting to move the iterator, or read
* the information about the current position of the iterator. * the information about the current position of the iterator.
* *
* This may return NULL to indicate that cloning is not supported. In * This may return NULL to indicate that cloning is not supported. In
 End of changes. 10 change blocks. 
9 lines changed or deleted 16 lines changed or added


 query.h   query.h 
/** @file query.h /** @file query.h
* @brief Xapian::Query API class * @brief Xapian::Query API class
*/ */
/* Copyright (C) 2011,2012 Olly Betts /* Copyright (C) 2011,2012,2013 Olly Betts
* Copyright (C) 2008 Richard Boulton * Copyright (C) 2008 Richard Boulton
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_QUERY_H #ifndef XAPIAN_INCLUDED_QUERY_H
#define XAPIAN_INCLUDED_QUERY_H #define XAPIAN_INCLUDED_QUERY_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/query.h> directly; include <xapian.h> instead."
#endif
#include <string> #include <string>
#include <vector>
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/postingiterator.h> #include <xapian/postingiterator.h>
#include <xapian/registry.h> #include <xapian/registry.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
class QueryOptimiser; // FIXME class QueryOptimiser; // FIXME
namespace Xapian { namespace Xapian {
skipping to change at line 110 skipping to change at line 114
* If the number of subqueries is less than this threshold, * If the number of subqueries is less than this threshold,
* OP_ELITE_SET behaves identically to OP_OR. * OP_ELITE_SET behaves identically to OP_OR.
*/ */
OP_ELITE_SET = 10, OP_ELITE_SET = 10,
OP_VALUE_GE = 11, OP_VALUE_GE = 11,
OP_VALUE_LE = 12, OP_VALUE_LE = 12,
OP_SYNONYM = 13 OP_SYNONYM = 13
}; };
/// Default constructor. /// Default constructor.
Query() : internal(0) { } XAPIAN_NOTHROW(Query())
: internal(0) { }
/// Destructor. /// Destructor.
~Query() { } ~Query() { }
/** Copying is allowed. /** Copying is allowed.
* *
* The internals are reference counted, so copying is cheap. * The internals are reference counted, so copying is cheap.
*/ */
Query(const Query & o) : internal(o.internal) { } Query(const Query & o) : internal(o.internal) { }
skipping to change at line 184 skipping to change at line 189
} }
} }
done(); done();
} }
#ifdef SWIG #ifdef SWIG
// SWIG's %template doesn't seem to handle a templated ctor so we // SWIG's %template doesn't seem to handle a templated ctor so we
// provide this fake specialised form of the above prototype. // provide this fake specialised form of the above prototype.
Query::Query(op op_, XapianSWIGQueryItor qbegin, XapianSWIGQueryItor qe nd, Query::Query(op op_, XapianSWIGQueryItor qbegin, XapianSWIGQueryItor qe nd,
Xapian::termcount parameter = 0); Xapian::termcount parameter = 0);
# ifdef SWIGJAVA
Query::Query(op op_, XapianSWIGStrItor qbegin, XapianSWIGStrItor qend,
Xapian::termcount parameter = 0);
# endif
#endif #endif
const TermIterator get_terms_begin() const; const TermIterator get_terms_begin() const;
const TermIterator get_terms_end() const { return TermIterator(); } const TermIterator XAPIAN_NOTHROW(get_terms_end() const) {
return TermIterator();
}
Xapian::termcount get_length() const; Xapian::termcount get_length() const XAPIAN_PURE_FUNCTION;
bool empty() const { return internal.get() == 0; } bool XAPIAN_NOTHROW(empty() const) XAPIAN_PURE_FUNCTION {
return internal.get() == 0;
}
std::string serialise() const; std::string serialise() const;
static const Query unserialise(const std::string & s, static const Query unserialise(const std::string & s,
const Registry & reg = Registry()); const Registry & reg = Registry());
std::string get_description() const; std::string get_description() const XAPIAN_PURE_FUNCTION;
const Query operator&=(const Query & o) { const Query operator&=(const Query & o) {
return (*this = Query(OP_AND, *this, o)); return (*this = Query(OP_AND, *this, o));
} }
const Query operator|=(const Query & o) { const Query operator|=(const Query & o) {
return (*this = Query(OP_OR, *this, o)); return (*this = Query(OP_OR, *this, o));
} }
const Query operator^=(const Query & o) { const Query operator^=(const Query & o) {
skipping to change at line 221 skipping to change at line 235
} }
const Query operator*=(double factor) { const Query operator*=(double factor) {
return (*this = Query(factor, *this)); return (*this = Query(factor, *this));
} }
const Query operator/=(double factor) { const Query operator/=(double factor) {
return (*this = Query(1.0 / factor, *this)); return (*this = Query(1.0 / factor, *this));
} }
private: /** @private @internal
// Pass a reference to avoid ambiguity for Query(NULL) (not useful, but *
the * Pass a reference to avoid ambiguity for Query(NULL) (not useful, bu
// testsuite does it...) FIXME t the
Query(Query::Internal & internal_) : internal(&internal_) { } * testsuite does it...) FIXME
*/
Query(Internal & internal_) : internal(&internal_) { }
private:
void init(Query::op op_, size_t n_subqueries, Xapian::termcount window = 0); void init(Query::op op_, size_t n_subqueries, Xapian::termcount window = 0);
template<typename I> template<typename I>
void init(Query::op op_, Xapian::termcount window, void init(Query::op op_, Xapian::termcount window,
const I & begin, const I & end, std::random_access_iterator_ta g) const I & begin, const I & end, std::random_access_iterator_ta g)
{ {
init(op_, end - begin, window); init(op_, end - begin, window);
} }
template<typename I> template<typename I>
skipping to change at line 332 skipping to change at line 349
} }
namespace Internal { namespace Internal {
class AndContext; class AndContext;
class OrContext; class OrContext;
class XorContext; class XorContext;
} }
class Query::Internal : public Xapian::Internal::intrusive_base { class Query::Internal : public Xapian::Internal::intrusive_base {
public: public:
Internal() { } XAPIAN_NOTHROW(Internal()) { }
virtual ~Internal(); virtual ~Internal();
virtual PostingIterator::Internal * postlist(QueryOptimiser * qopt, dou ble factor) const = 0; virtual PostingIterator::Internal * postlist(QueryOptimiser * qopt, dou ble factor) const = 0;
virtual void postlist_sub_and_like(Xapian::Internal::AndContext& ctx, virtual void postlist_sub_and_like(Xapian::Internal::AndContext& ctx,
QueryOptimiser * qopt, QueryOptimiser * qopt,
double factor) const; double factor) const;
virtual void postlist_sub_or_like(Xapian::Internal::OrContext& ctx, virtual void postlist_sub_or_like(Xapian::Internal::OrContext& ctx,
QueryOptimiser * qopt, QueryOptimiser * qopt,
double factor) const; double factor) const;
virtual void postlist_sub_xor(Xapian::Internal::XorContext& ctx, virtual void postlist_sub_xor(Xapian::Internal::XorContext& ctx,
QueryOptimiser * qopt, QueryOptimiser * qopt,
double factor) const; double factor) const;
virtual termcount get_length() const; virtual termcount get_length() const XAPIAN_PURE_FUNCTION;
virtual void serialise(std::string & result) const = 0; virtual void serialise(std::string & result) const = 0;
static Query::Internal * unserialise(const char ** p, const char * end, const Registry & reg); static Query::Internal * unserialise(const char ** p, const char * end, const Registry & reg);
virtual std::string get_description() const = 0; virtual std::string get_description() const XAPIAN_PURE_FUNCTION = 0;
virtual void gather_terms(std::vector<std::pair<Xapian::termpos, std::s // Pass argument as void* to avoid need to include <vector>.
tring> > &terms) const; virtual void gather_terms(void * void_terms) const;
}; };
} }
#endif // XAPIAN_INCLUDED_QUERY_H #endif // XAPIAN_INCLUDED_QUERY_H
 End of changes. 16 change blocks. 
17 lines changed or deleted 34 lines changed or added


 queryparser.h   queryparser.h 
/** @file queryparser.h /** @file queryparser.h
* @brief parsing a user query string to build a Xapian::Query object * @brief parsing a user query string to build a Xapian::Query object
*/ */
/* Copyright (C) 2005,2006,2007,2008,2009,2010,2011,2012 Olly Betts /* Copyright (C) 2005,2006,2007,2008,2009,2010,2011,2012,2013 Olly Betts
* Copyright (C) 2010 Adam Sjøgren * Copyright (C) 2010 Adam Sjøgren
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 26 skipping to change at line 26
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_QUERYPARSER_H #ifndef XAPIAN_INCLUDED_QUERYPARSER_H
#define XAPIAN_INCLUDED_QUERYPARSER_H #define XAPIAN_INCLUDED_QUERYPARSER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/queryparser.h> directly; include <xapian.h> inst
ead."
#endif
#include <xapian/attributes.h>
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/query.h> #include <xapian/query.h>
#include <xapian/termiterator.h> #include <xapian/termiterator.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <set> #include <set>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
skipping to change at line 224 skipping to change at line 229
* For example, if str_ is "created:" and prefix_ is true, and the ran ge * For example, if str_ is "created:" and prefix_ is true, and the ran ge
* processor has been added to the queryparser, the queryparser will * processor has been added to the queryparser, the queryparser will
* accept "created:1/1/2000..31/12/2001". * accept "created:1/1/2000..31/12/2001".
*/ */
DateValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, DateValueRangeProcessor(Xapian::valueno slot_, const std::string &str_,
bool prefix_ = true, bool prefix_ = true,
bool prefer_mdy_ = false, int epoch_year_ = 1970 ) bool prefer_mdy_ = false, int epoch_year_ = 1970 )
: StringValueRangeProcessor(slot_, str_, prefix_), : StringValueRangeProcessor(slot_, str_, prefix_),
prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { } prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { }
#ifndef SWIG
/** Constructor.
*
* This is like the previous version, but with const char * instead of
* std::string - we need this overload as otherwise
* DateValueRangeProcessor(1, "date:") quietly interprets the second
* argument as a boolean in preference to std::string. If you want to
* be compatible with 1.2.12 and earlier, then explicitly convert to
* std::string, i.e.: DateValueRangeProcessor(1, std::string("date:"))
*
* @param slot_ The value number to return from operator().
*
* @param str_ A string to look for to recognise values as belongi
ng
* to this date range.
*
* @param prefix_ Whether to look for the string at the start or end
of
* the values. If true, the string is a prefix; if
* false, the string is a suffix (default: true).
*
* @param prefer_mdy_ Should ambiguous dates be interpreted as
* month/day/year rather than day/month/year?
* (default: false)
*
* @param epoch_year_ Year to use as the epoch for dates with 2 digit
* years (default: 1970, so 1/1/69 is 2069 while
* 1/1/70 is 1970).
*
* The string supplied in str_ is used by @a operator() to decide whet
her
* the pair of strings supplied to it constitute a valid range. If
* prefix_ is true, the first value in a range must begin with str_ (a
nd
* the second value may optionally begin with str_);
* if prefix_ is false, the second value in a range must end with str_
* (and the first value may optionally end with str_).
*
* If str_ is empty, the setting of prefix_ is irrelevant, and no spec
ial
* strings are required at the start or end of the strings defining th
e
* range.
*
* The remainder of both strings defining the endpoints must be valid
* dates.
*
* For example, if str_ is "created:" and prefix_ is true, and the ran
ge
* processor has been added to the queryparser, the queryparser will
* accept "created:1/1/2000..31/12/2001".
*/
DateValueRangeProcessor(Xapian::valueno slot_, const char * str_,
bool prefix_ = true,
bool prefer_mdy_ = false, int epoch_year_ = 1970
)
: StringValueRangeProcessor(slot_, str_, prefix_),
prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { }
#endif
/** Check for a valid date range. /** Check for a valid date range.
* *
* @param[in,out] begin The start of the range as specified in the * @param[in,out] begin The start of the range as specified in the
* query string by the user. This parameter is a * query string by the user. This parameter is a
* non-const reference so the ValueRangeProcess or * non-const reference so the ValueRangeProcess or
* can modify it to return the value to start t he * can modify it to return the value to start t he
* range with. * range with.
* @param[in,out] end The end of the range. This is also a non-co nst * @param[in,out] end The end of the range. This is also a non-co nst
* reference so it can be modified. * reference so it can be modified.
* *
skipping to change at line 314 skipping to change at line 371
* @return If BEGIN..END is a valid numeric range with the spec ified * @return If BEGIN..END is a valid numeric range with the spec ified
* prefix/suffix (if one was specified), this method modifies * prefix/suffix (if one was specified), this method modifies
* them by removing the prefix/suffix, converting to a number, * them by removing the prefix/suffix, converting to a number,
* and encoding with Xapian::sortable_serialise(), and returns the * and encoding with Xapian::sortable_serialise(), and returns the
* value of slot_ passed at construction time. Otherwise it * value of slot_ passed at construction time. Otherwise it
* returns Xapian::BAD_VALUENO. * returns Xapian::BAD_VALUENO.
*/ */
Xapian::valueno operator()(std::string &begin, std::string &end); Xapian::valueno operator()(std::string &begin, std::string &end);
}; };
/** Base class for field processors.
*
* Experimental API - may change.
*/
struct XAPIAN_VISIBILITY_DEFAULT FieldProcessor {
/// Destructor.
virtual ~FieldProcessor();
/** Convert a field-prefixed string to a Query object.
*
* @param str The string to convert.
*
* @return Query object corresponding to @a str.
*/
virtual Xapian::Query operator()(const std::string &str) = 0;
};
/// Build a Xapian::Query object from a user query string. /// Build a Xapian::Query object from a user query string.
class XAPIAN_VISIBILITY_DEFAULT QueryParser { class XAPIAN_VISIBILITY_DEFAULT QueryParser {
public: public:
/// Class representing the queryparser internals. /// Class representing the queryparser internals.
class Internal; class Internal;
/// @private @internal Reference counted internals. /// @private @internal Reference counted internals.
Xapian::Internal::intrusive_ptr<Internal> internal; Xapian::Internal::intrusive_ptr<Internal> internal;
/// Enum of feature flags. /// Enum of feature flags.
typedef enum { typedef enum {
skipping to change at line 412 skipping to change at line 486
/** The default flags. /** The default flags.
* *
* Used if you don't explicitly pass any to @a parse_query(). * Used if you don't explicitly pass any to @a parse_query().
* The default flags are FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE. * The default flags are FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE.
* *
* Added in Xapian 1.0.11. * Added in Xapian 1.0.11.
*/ */
FLAG_DEFAULT = FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE FLAG_DEFAULT = FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE
} feature_flag; } feature_flag;
typedef enum { STEM_NONE, STEM_SOME, STEM_ALL } stem_strategy; /// Stemming strategies, for use with set_stemming_strategy().
typedef enum { STEM_NONE, STEM_SOME, STEM_ALL, STEM_ALL_Z } stem_strate
gy;
/// Copy constructor. /// Copy constructor.
QueryParser(const QueryParser & o); QueryParser(const QueryParser & o);
/// Assignment. /// Assignment.
QueryParser & operator=(const QueryParser & o); QueryParser & operator=(const QueryParser & o);
/// Default constructor. /// Default constructor.
QueryParser(); QueryParser();
/// Destructor. /// Destructor.
~QueryParser(); ~QueryParser();
/** Set the stemmer. /** Set the stemmer.
* *
* This sets the stemming algorithm which will be used by the query * This sets the stemming algorithm which will be used by the query
* parser. Note that the stemming algorithm will only be used accordi * parser. The stemming algorithm will be used according to the stemm
ng ing
* to the stemming strategy set by set_stemming_strategy(), which defa * strategy set by set_stemming_strategy(). As of 1.3.1, this default
ults s
* to STEM_NONE. Therefore, to use a stemming algorithm, you will als * to STEM_SOME, but in earlier versions the default was STEM_NONE. I
o f
* need to call set_stemming_strategy() with a value other than STEM_N * you want to work with older versions, you should explicitly set
ONE. * a stemming strategy as well as setting a stemmer, otherwise your
* stemmer won't actually be used.
* *
* @param stemmer The Xapian::Stem object to set. * @param stemmer The Xapian::Stem object to set.
*/ */
void set_stemmer(const Xapian::Stem & stemmer); void set_stemmer(const Xapian::Stem & stemmer);
/** Set the stemming strategy. /** Set the stemming strategy.
* *
* This controls how the query parser will apply the stemming algorith m. * This controls how the query parser will apply the stemming algorith m.
* Note that the stemming algorithm is only applied to words in * Note that the stemming algorithm is only applied to words in
* probabilistic fields - boolean filter terms are never stemmed. * probabilistic fields - boolean filter terms are never stemmed.
* *
* @param strategy The strategy to use - possible values are: * @param strategy The strategy to use - possible values are:
* - STEM_NONE: Don't perform any stemming (the default). * - STEM_NONE: Don't perform any stemming. (default in Xapian <=
* - STEM_SOME: Search for stemmed forms of terms except for those wh * 1.3.0)
ich * - STEM_SOME: Search for stemmed forms of terms except for those
* start with a capital letter, or are followed by certai * which start with a capital letter, or are followed b
n y
* characters (currently: (/\@<>=*[{" ), or are used with * certain characters (currently: (/\@<>=*[{" ), or are
* operators which need positional information. Stemmed * used with operators which need positional informatio
* terms are prefixed with 'Z'. n.
* - STEM_ALL: Search for stemmed forms of all words (note: no 'Z' * Stemmed terms are prefixed with 'Z'. (default in
* prefix is added). * Xapian >= 1.3.1)
* - STEM_ALL: Search for stemmed forms of all words (note: no 'Z'
* prefix is added).
* - STEM_ALL_Z: Search for stemmed forms of all words (note: 'Z'
* prefix is added). (new in Xapian 1.2.11 and 1.3.1)
*/ */
void set_stemming_strategy(stem_strategy strategy); void set_stemming_strategy(stem_strategy strategy);
/** Set the stopper. /** Set the stopper.
* *
* @param stop The Stopper object to set (default NULL, which means no * @param stop The Stopper object to set (default NULL, which means no
* stopwords). * stopwords).
*/ */
void set_stopper(const Stopper *stop = NULL); void set_stopper(const Stopper *stop = NULL);
skipping to change at line 568 skipping to change at line 649
* will be thrown. * will be thrown.
* *
* In 1.0.3 and earlier, subsequent calls to this method with the same * In 1.0.3 and earlier, subsequent calls to this method with the same
* value of @a field had no effect. * value of @a field had no effect.
* *
* @param field The user visible field name * @param field The user visible field name
* @param prefix The term prefix to map this to * @param prefix The term prefix to map this to
*/ */
void add_prefix(const std::string &field, const std::string &prefix); void add_prefix(const std::string &field, const std::string &prefix);
/** Register a FieldProcessor.
*
* Experimental API - may change.
*/
void add_prefix(const std::string &field, Xapian::FieldProcessor * proc
);
/** Add a boolean term prefix allowing the user to restrict a /** Add a boolean term prefix allowing the user to restrict a
* search with a boolean filter specified in the free text query. * search with a boolean filter specified in the free text query.
* *
* For example: * For example:
* *
* @code * @code
* qp.add_boolean_prefix("site", "H"); * qp.add_boolean_prefix("site", "H");
* @endcode * @endcode
* *
* This allows the user to restrict a search with site:xapian.org whic h * This allows the user to restrict a search with site:xapian.org whic h
skipping to change at line 623 skipping to change at line 710
* this prefix, so multiple filters with this prefix * this prefix, so multiple filters with this prefix
* should be combined with OP_OR. If false, each * should be combined with OP_OR. If false, each
* document can have multiple terms with this prefix, so * document can have multiple terms with this prefix, so
* multiple filters should be combined with OP_AND, li ke * multiple filters should be combined with OP_AND, li ke
* happens with filters with different prefixes. * happens with filters with different prefixes.
* [default: true] * [default: true]
*/ */
void add_boolean_prefix(const std::string &field, const std::string &pr efix, void add_boolean_prefix(const std::string &field, const std::string &pr efix,
bool exclusive = true); bool exclusive = true);
/** Register a FieldProcessor for a boolean prefix.
*
* Experimental API - may change.
*/
void add_boolean_prefix(const std::string &field, Xapian::FieldProcesso
r *proc,
bool exclusive = true);
/// Iterate over terms omitted from the query as stopwords. /// Iterate over terms omitted from the query as stopwords.
TermIterator stoplist_begin() const; TermIterator stoplist_begin() const;
TermIterator stoplist_end() const { TermIterator XAPIAN_NOTHROW(stoplist_end() const) {
return TermIterator(); return TermIterator();
} }
/// Iterate over unstemmed forms of the given (stemmed) term used in th e query. /// Iterate over unstemmed forms of the given (stemmed) term used in th e query.
TermIterator unstem_begin(const std::string &term) const; TermIterator unstem_begin(const std::string &term) const;
TermIterator unstem_end(const std::string &) const { TermIterator XAPIAN_NOTHROW(unstem_end(const std::string &) const) {
return TermIterator(); return TermIterator();
} }
/// Register a ValueRangeProcessor. /// Register a ValueRangeProcessor.
void add_valuerangeprocessor(Xapian::ValueRangeProcessor * vrproc); void add_valuerangeprocessor(Xapian::ValueRangeProcessor * vrproc);
/** Get the spelling-corrected query string. /** Get the spelling-corrected query string.
* *
* This will only be set if FLAG_SPELLING_CORRECTION is specified when * This will only be set if FLAG_SPELLING_CORRECTION is specified when
* QueryParser::parse_query() was last called. * QueryParser::parse_query() was last called.
* *
* If there were no corrections, an empty string is returned. * If there were no corrections, an empty string is returned.
*/ */
std::string get_corrected_query_string() const; std::string get_corrected_query_string() const XAPIAN_PURE_FUNCTION;
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const XAPIAN_PURE_FUNCTION;
}; };
/** Convert a floating point number to a string, preserving sort order. /** Convert a floating point number to a string, preserving sort order.
* *
* This method converts a floating point number to a string, suitable for * This method converts a floating point number to a string, suitable for
* using as a value for numeric range restriction, or for use as a sort * using as a value for numeric range restriction, or for use as a sort
* key. * key.
* *
* The conversion is platform independent. * The conversion is platform independent.
* *
skipping to change at line 678 skipping to change at line 772
* Note also that both zero and -zero will be converted to the same * Note also that both zero and -zero will be converted to the same
* representation: since these compare equal, this satisfies the * representation: since these compare equal, this satisfies the
* comparison constraint, but it's worth knowing this if you wish to use * comparison constraint, but it's worth knowing this if you wish to use
* the encoding in some situation where this distinction matters. * the encoding in some situation where this distinction matters.
* *
* Handling of NaN isn't (currently) guaranteed to be sensible. * Handling of NaN isn't (currently) guaranteed to be sensible.
* *
* @param value The number to serialise. * @param value The number to serialise.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
std::string sortable_serialise(double value); std::string sortable_serialise(double value) XAPIAN_CONST_FUNCTION;
/** Convert a string encoded using @a sortable_serialise back to a floating /** Convert a string encoded using @a sortable_serialise back to a floating
* point number. * point number.
* *
* This expects the input to be a string produced by @a sortable_serialise (). * This expects the input to be a string produced by @a sortable_serialise ().
* If the input is not such a string, the value returned is undefined (but * If the input is not such a string, the value returned is undefined (but
* no error will be thrown). * no error will be thrown).
* *
* The result of the conversion will be exactly the value which was * The result of the conversion will be exactly the value which was
* supplied to @a sortable_serialise() when making the string on platforms * supplied to @a sortable_serialise() when making the string on platforms
* which represent doubles with the precisions specified by IEEE_754, but * which represent doubles with the precisions specified by IEEE_754, but
* may be a different (nearby) value on other platforms. * may be a different (nearby) value on other platforms.
* *
* @param value The serialised string to decode. * @param value The serialised string to decode.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
double sortable_unserialise(const std::string & value); double sortable_unserialise(const std::string & value) XAPIAN_CONST_FUNCTIO N;
} }
#endif // XAPIAN_INCLUDED_QUERYPARSER_H #endif // XAPIAN_INCLUDED_QUERYPARSER_H
 End of changes. 15 change blocks. 
26 lines changed or deleted 131 lines changed or added


 registry.h   registry.h 
/** @file registry.h /** @file registry.h
* @brief Class for looking up user subclasses during unserialisation. * @brief Class for looking up user subclasses during unserialisation.
*/ */
/* Copyright 2009 Lemur Consulting Ltd /* Copyright 2009 Lemur Consulting Ltd
* Copyright 2009,2011 Olly Betts * Copyright 2009,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_REGISTRY_H #ifndef XAPIAN_INCLUDED_REGISTRY_H
#define XAPIAN_INCLUDED_REGISTRY_H #define XAPIAN_INCLUDED_REGISTRY_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/registry.h> directly; include <xapian.h> instead
."
#endif
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
// Forward declarations. // Forward declarations.
class LatLongMetric; class LatLongMetric;
class MatchSpy; class MatchSpy;
class PostingSource; class PostingSource;
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 stem.h   stem.h 
/** @file stem.h /** @file stem.h
* @brief stemming algorithms * @brief stemming algorithms
*/ */
/* Copyright (C) 2005,2007,2010,2011 Olly Betts /* Copyright (C) 2005,2007,2010,2011,2013 Olly Betts
* Copyright (C) 2010 Evgeny Sizikov * Copyright (C) 2010 Evgeny Sizikov
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_STEM_H #ifndef XAPIAN_INCLUDED_STEM_H
#define XAPIAN_INCLUDED_STEM_H #define XAPIAN_INCLUDED_STEM_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/stem.h> directly; include <xapian.h> instead."
#endif
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
/// Class representing a stemming algorithm implementation. /// Class representing a stemming algorithm implementation.
struct XAPIAN_VISIBILITY_DEFAULT StemImplementation struct XAPIAN_VISIBILITY_DEFAULT StemImplementation
: public Xapian::Internal::intrusive_base : public Xapian::Internal::intrusive_base
 End of changes. 2 change blocks. 
1 lines changed or deleted 5 lines changed or added


 termgenerator.h   termgenerator.h 
/** @file termgenerator.h /** @file termgenerator.h
* @brief parse free text and generate terms * @brief parse free text and generate terms
*/ */
/* Copyright (C) 2007,2009,2011 Olly Betts /* Copyright (C) 2007,2009,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_TERMGENERATOR_H #ifndef XAPIAN_INCLUDED_TERMGENERATOR_H
#define XAPIAN_INCLUDED_TERMGENERATOR_H #define XAPIAN_INCLUDED_TERMGENERATOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/termgenerator.h> directly; include <xapian.h> in
stead."
#endif
#include <xapian/intrusive_ptr.h> #include <xapian/intrusive_ptr.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/unicode.h> #include <xapian/unicode.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
class Document; class Document;
skipping to change at line 91 skipping to change at line 95
/// Set the database to index spelling data to. /// Set the database to index spelling data to.
void set_database(const Xapian::WritableDatabase &db); void set_database(const Xapian::WritableDatabase &db);
/// Flags to OR together and pass to TermGenerator::set_flags(). /// Flags to OR together and pass to TermGenerator::set_flags().
enum flags { enum flags {
/// Index data required for spelling correction. /// Index data required for spelling correction.
FLAG_SPELLING = 128 // Value matches QueryParser flag. FLAG_SPELLING = 128 // Value matches QueryParser flag.
}; };
/// Stemming strategies, for use with set_stemming_strategy().
typedef enum { STEM_NONE, STEM_SOME, STEM_ALL, STEM_ALL_Z } stem_strate
gy;
/** Set flags. /** Set flags.
* *
* The new value of flags is: (flags & mask) ^ toggle * The new value of flags is: (flags & mask) ^ toggle
* *
* To just set the flags, pass the new flags in toggle and the * To just set the flags, pass the new flags in toggle and the
* default value for mask. * default value for mask.
* *
* @param toggle Flags to XOR. * @param toggle Flags to XOR.
* @param mask Flags to AND with first. * @param mask Flags to AND with first.
* *
* @return The old flags setting. * @return The old flags setting.
*/ */
flags set_flags(flags toggle, flags mask = flags(0)); flags set_flags(flags toggle, flags mask = flags(0));
/** Set the stemming strategy.
*
* This method controls how the stemming algorithm is applied. It was
* new in Xapian 1.3.1.
*
* @param strategy The strategy to use - possible values are:
* - STEM_NONE: Don't perform any stemming - only unstemmed terms
* are generated.
* - STEM_SOME: Generate both stemmed (with a "Z" prefix) and unstem
med
* terms. This is the default strategy.
* - STEM_ALL: Generate only stemmed terms (but without a "Z" prefi
x).
* - STEM_ALL_Z: Generate only stemmed terms (with a "Z" prefix).
*/
void set_stemming_strategy(stem_strategy strategy);
/** Set the maximum length word to index.
*
* The limit is on the length of a word prior to stemming and prior to
* adding any term prefix.
*
* The backends mostly impose a limit on the length of terms (often of
* about 240 bytes), but it's generally useful to have a lower limit t
o
* help prevent the index being bloated by useless junk terms from try
ing
* to indexing things like binary data, uuencoded data, ASCII art, etc
.
*
* This method was new in Xapian 1.3.1.
*
* @param max_word_length The maximum length word to index, in bytes i
n
* UTF-8 representation. Default is 64.
*/
void set_max_word_length(unsigned max_word_length);
/** Index some text. /** Index some text.
* *
* @param itor Utf8Iterator pointing to the text to index. * @param itor Utf8Iterator pointing to the text to index.
* @param wdf_inc The wdf increment (default 1). * @param wdf_inc The wdf increment (default 1).
* @param prefix The term prefix to use (default is no prefix). * @param prefix The term prefix to use (default is no prefix).
*/ */
void index_text(const Xapian::Utf8Iterator & itor, void index_text(const Xapian::Utf8Iterator & itor,
Xapian::termcount wdf_inc = 1, Xapian::termcount wdf_inc = 1,
const std::string & prefix = std::string()); const std::string & prefix = std::string());
 End of changes. 4 change blocks. 
1 lines changed or deleted 48 lines changed or added


 termiterator.h   termiterator.h 
/** @file termiterator.h /** @file termiterator.h
* @brief Class for iterating over a list of terms * @brief Class for iterating over a list of terms
*/ */
/* Copyright (C) 2007,2008,2009,2010,2011 Olly Betts /* Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_TERMITERATOR_H #ifndef XAPIAN_INCLUDED_TERMITERATOR_H
#define XAPIAN_INCLUDED_TERMITERATOR_H #define XAPIAN_INCLUDED_TERMITERATOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/termiterator.h> directly; include <xapian.h> ins
tead."
#endif
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/derefwrapper.h> #include <xapian/derefwrapper.h>
#include <xapian/positioniterator.h> #include <xapian/positioniterator.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/// Class for iterating over a list of terms. /// Class for iterating over a list of terms.
class XAPIAN_VISIBILITY_DEFAULT TermIterator { class XAPIAN_VISIBILITY_DEFAULT TermIterator {
public: public:
skipping to change at line 57 skipping to change at line 62
TermIterator(const TermIterator & o); TermIterator(const TermIterator & o);
/// Assignment. /// Assignment.
TermIterator & operator=(const TermIterator & o); TermIterator & operator=(const TermIterator & o);
/** Default constructor. /** Default constructor.
* *
* Creates an uninitialised iterator, which can't be used before being * Creates an uninitialised iterator, which can't be used before being
* assigned to, but is sometimes syntactically convenient. * assigned to, but is sometimes syntactically convenient.
*/ */
TermIterator() : internal(0) { } XAPIAN_NOTHROW(TermIterator())
: internal(0) { }
/// Destructor. /// Destructor.
~TermIterator() { ~TermIterator() {
if (internal) decref(); if (internal) decref();
} }
/// Return the term at the current position. /// Return the term at the current position.
std::string operator*() const; std::string operator*() const XAPIAN_PURE_FUNCTION;
/// Return the wdf for the term at the current position. /// Return the wdf for the term at the current position.
Xapian::termcount get_wdf() const; Xapian::termcount get_wdf() const XAPIAN_PURE_FUNCTION;
/// Return the term frequency for the term at the current position. /// Return the term frequency for the term at the current position.
Xapian::doccount get_termfreq() const; Xapian::doccount get_termfreq() const XAPIAN_PURE_FUNCTION;
/// Return the length of the position list for the current position. /// Return the length of the position list for the current position.
Xapian::termcount positionlist_count() const; Xapian::termcount positionlist_count() const;
/// Return a PositionIterator for the current term. /// Return a PositionIterator for the current term.
PositionIterator positionlist_begin() const; PositionIterator positionlist_begin() const;
/// Return an end PositionIterator for the current term. /// Return an end PositionIterator for the current term.
PositionIterator positionlist_end() const { PositionIterator XAPIAN_NOTHROW(positionlist_end() const) {
return PositionIterator(); return PositionIterator();
} }
/// Advance the iterator to the next position. /// Advance the iterator to the next position.
TermIterator & operator++(); TermIterator & operator++();
/// Advance the iterator to the next position (postfix version). /// Advance the iterator to the next position (postfix version).
DerefWrapper_<std::string> operator++(int) { DerefWrapper_<std::string> operator++(int) {
const std::string & term(**this); const std::string & term(**this);
operator++(); operator++();
skipping to change at line 106 skipping to change at line 112
* If the iteration is over an unsorted list of terms, then this metho d * If the iteration is over an unsorted list of terms, then this metho d
* will throw Xapian::InvalidOperationError. * will throw Xapian::InvalidOperationError.
* *
* @param term The term to advance to. If this term isn't in * @param term The term to advance to. If this term isn't in
* the stream being iterated, then the iterator is move d * the stream being iterated, then the iterator is move d
* to the next term after it which is. * to the next term after it which is.
*/ */
void skip_to(const std::string &term); void skip_to(const std::string &term);
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const XAPIAN_PURE_FUNCTION;
/** @private @internal TermIterator is what the C++ STL calls an /** @private @internal TermIterator is what the C++ STL calls an
* input_iterator. * input_iterator.
* *
* The following typedefs allow std::iterator_traits<> to work so that * The following typedefs allow std::iterator_traits<> to work so that
* this iterator can be used with the STL. * this iterator can be used with the STL.
* *
* These are deliberately hidden from the Doxygen-generated docs, as t he * These are deliberately hidden from the Doxygen-generated docs, as t he
* machinery here isn't interesting to API users. They just need to k now * machinery here isn't interesting to API users. They just need to k now
* that Xapian iterator classes are compatible with the STL. * that Xapian iterator classes are compatible with the STL.
skipping to change at line 137 skipping to change at line 143
/// @private /// @private
typedef std::string & reference; typedef std::string & reference;
// @} // @}
private: private:
void decref(); void decref();
void post_advance(Internal * res); void post_advance(Internal * res);
}; };
bool
XAPIAN_NOTHROW(operator==(const TermIterator &a, const TermIterator &b));
/// Equality test for TermIterator objects. /// Equality test for TermIterator objects.
inline bool inline bool
operator==(const TermIterator &a, const TermIterator &b) operator==(const TermIterator &a, const TermIterator &b)
{ {
// Use a pointer comparison - this ensures both that (a == a) and corre ct // Use a pointer comparison - this ensures both that (a == a) and corre ct
// handling of end iterators (which we ensure have NULL internals). // handling of end iterators (which we ensure have NULL internals).
return a.internal == b.internal; return a.internal == b.internal;
} }
bool
XAPIAN_NOTHROW(operator!=(const TermIterator &a, const TermIterator &b));
/// Inequality test for TermIterator objects. /// Inequality test for TermIterator objects.
inline bool inline bool
operator!=(const TermIterator &a, const TermIterator &b) operator!=(const TermIterator &a, const TermIterator &b)
{ {
return !(a == b); return !(a == b);
} }
} }
#endif // XAPIAN_INCLUDED_TERMITERATOR_H #endif // XAPIAN_INCLUDED_TERMITERATOR_H
 End of changes. 11 change blocks. 
7 lines changed or deleted 20 lines changed or added


 types.h   types.h 
/** @file xapian/types.h /** @file xapian/types.h
* @brief typedefs for Xapian * @brief typedefs for Xapian
*/ */
/* Copyright (C) 2007,2010,2011 Olly Betts /* Copyright (C) 2007,2010,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_TYPES_H #ifndef XAPIAN_INCLUDED_TYPES_H
#define XAPIAN_INCLUDED_TYPES_H #define XAPIAN_INCLUDED_TYPES_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/types.h> directly; include <xapian.h> instead."
#endif
#include <xapian/deprecated.h> #include <xapian/deprecated.h>
namespace Xapian { namespace Xapian {
/** A count of documents. /** A count of documents.
* *
* This is used to hold values such as the number of documents in a databa se * This is used to hold values such as the number of documents in a databa se
* and the frequency of a term in the database. * and the frequency of a term in the database.
*/ */
typedef unsigned doccount; typedef unsigned doccount;
 End of changes. 2 change blocks. 
1 lines changed or deleted 5 lines changed or added


 unicode.h   unicode.h 
/** @file unicode.h /** @file unicode.h
* @brief Unicode and UTF-8 related classes and functions. * @brief Unicode and UTF-8 related classes and functions.
*/ */
/* Copyright (C) 2006,2007,2008,2009,2010,2011 Olly Betts /* Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
*/ */
#ifndef XAPIAN_INCLUDED_UNICODE_H #ifndef XAPIAN_INCLUDED_UNICODE_H
#define XAPIAN_INCLUDED_UNICODE_H #define XAPIAN_INCLUDED_UNICODE_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/unicode.h> directly; include <xapian.h> instead.
"
#endif
#include <xapian/attributes.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
#include <string> #include <string>
namespace Xapian { namespace Xapian {
/** An iterator which returns Unicode character values from a UTF-8 encoded /** An iterator which returns Unicode character values from a UTF-8 encoded
* string. * string.
*/ */
class XAPIAN_VISIBILITY_DEFAULT Utf8Iterator { class XAPIAN_VISIBILITY_DEFAULT Utf8Iterator {
skipping to change at line 47 skipping to change at line 52
void calculate_sequence_length() const; void calculate_sequence_length() const;
unsigned get_char() const; unsigned get_char() const;
Utf8Iterator(const unsigned char *p_, const unsigned char *end_, unsign ed seqlen_) Utf8Iterator(const unsigned char *p_, const unsigned char *end_, unsign ed seqlen_)
: p(p_), end(end_), seqlen(seqlen_) { } : p(p_), end(end_), seqlen(seqlen_) { }
public: public:
/** Return the raw const char * pointer for the current position. */ /** Return the raw const char * pointer for the current position. */
const char * raw() const { const char * raw() const XAPIAN_PURE_FUNCTION {
return reinterpret_cast<const char *>(p ? p : end); return reinterpret_cast<const char *>(p ? p : end);
} }
/** Return the number of bytes left in the iterator's buffer. */ /** Return the number of bytes left in the iterator's buffer. */
size_t left() const { return p ? end - p : 0; } size_t left() const XAPIAN_PURE_FUNCTION { return p ? end - p : 0; }
/** Assign a new string to the iterator. /** Assign a new string to the iterator.
* *
* The iterator will forget the string it was iterating through, and * The iterator will forget the string it was iterating through, and
* return characters from the start of the new string when next called . * return characters from the start of the new string when next called .
* The string is not copied into the iterator, so it must remain valid * The string is not copied into the iterator, so it must remain valid
* while the iteration is in progress. * while the iteration is in progress.
* *
* @param p_ A pointer to the start of the string to read. * @param p_ A pointer to the start of the string to read.
* *
skipping to change at line 125 skipping to change at line 130
* @param s The string to read. Must not be modified while the iterat ion * @param s The string to read. Must not be modified while the iterat ion
* is in progress. * is in progress.
*/ */
Utf8Iterator(const std::string &s) { assign(s.data(), s.size()); } Utf8Iterator(const std::string &s) { assign(s.data(), s.size()); }
/** Create an iterator which is at the end of its iteration. /** Create an iterator which is at the end of its iteration.
* *
* This can be compared to another iterator to check if the other iter ator * This can be compared to another iterator to check if the other iter ator
* has reached its end. * has reached its end.
*/ */
Utf8Iterator() : p(NULL), end(0), seqlen(0) { } XAPIAN_NOTHROW(Utf8Iterator())
: p(NULL), end(0), seqlen(0) { }
/** Get the current Unicode character value pointed to by the iterator. /** Get the current Unicode character value pointed to by the iterator.
* *
* Returns unsigned(-1) if the iterator has reached the end of its buf fer. * Returns unsigned(-1) if the iterator has reached the end of its buf fer.
*/ */
unsigned operator*() const; unsigned operator*() const XAPIAN_PURE_FUNCTION;
/** Move forward to the next Unicode character. /** Move forward to the next Unicode character.
* *
* @return An iterator pointing to the position before the move. * @return An iterator pointing to the position before the move.
*/ */
Utf8Iterator operator++(int) { Utf8Iterator operator++(int) {
// If we've not calculated seqlen yet, do so. // If we've not calculated seqlen yet, do so.
if (seqlen == 0) calculate_sequence_length(); if (seqlen == 0) calculate_sequence_length();
const unsigned char *old_p = p; const unsigned char *old_p = p;
unsigned old_seqlen = seqlen; unsigned old_seqlen = seqlen;
skipping to change at line 165 skipping to change at line 171
if (p == end) p = NULL; if (p == end) p = NULL;
seqlen = 0; seqlen = 0;
return *this; return *this;
} }
/** Test two Utf8Iterators for equality. /** Test two Utf8Iterators for equality.
* *
* @param other The Utf8Iterator to compare this one with. * @param other The Utf8Iterator to compare this one with.
* @return true iff the iterators point to the same position. * @return true iff the iterators point to the same position.
*/ */
bool operator==(const Utf8Iterator &other) const { return p == other.p; bool XAPIAN_NOTHROW(operator==(const Utf8Iterator &other) const) {
} return p == other.p;
}
/** Test two Utf8Iterators for inequality. /** Test two Utf8Iterators for inequality.
* *
* @param other The Utf8Iterator to compare this one with. * @param other The Utf8Iterator to compare this one with.
* @return true iff the iterators do not point to the same position. * @return true iff the iterators do not point to the same position.
*/ */
bool operator!=(const Utf8Iterator &other) const { return p != other.p; bool XAPIAN_NOTHROW(operator!=(const Utf8Iterator &other) const) {
} return p != other.p;
}
/// We implement the semantics of an STL input_iterator. /// We implement the semantics of an STL input_iterator.
//@{ //@{
typedef std::input_iterator_tag iterator_category; typedef std::input_iterator_tag iterator_category;
typedef unsigned value_type; typedef unsigned value_type;
typedef size_t difference_type; typedef size_t difference_type;
typedef const unsigned * pointer; typedef const unsigned * pointer;
typedef const unsigned & reference; typedef const unsigned & reference;
//@} //@}
}; };
skipping to change at line 228 skipping to change at line 238
OTHER_SYMBOL OTHER_SYMBOL
} category; } category;
namespace Internal { namespace Internal {
/** @internal Extract the information about a character from the Unicod e /** @internal Extract the information about a character from the Unicod e
* character tables. * character tables.
* *
* ch must be a valid Unicode character value (i.e. < 0x110000) * ch must be a valid Unicode character value (i.e. < 0x110000)
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
int get_character_info(unsigned ch); int get_character_info(unsigned ch) XAPIAN_CONST_FUNCTION;
/** @internal Extract how to convert the case of a Unicode character fr om /** @internal Extract how to convert the case of a Unicode character fr om
* its info. * its info.
*/ */
inline int get_case_type(int info) { return ((info & 0xe0) >> 5); } inline int get_case_type(int info) { return ((info & 0xe0) >> 5); }
/// @internal Extract the category of a Unicode character from its info . /// @internal Extract the category of a Unicode character from its info .
inline category get_category(int info) { return static_cast<category>(i nfo & 0x1f); } inline category get_category(int info) { return static_cast<category>(i nfo & 0x1f); }
/** @internal Extract the delta to use for case conversion of a charact er /** @internal Extract the delta to use for case conversion of a charact er
* from its info. * from its info.
*/ */
inline int get_delta(int info) { inline int get_delta(int info) {
/* It's implementation defined if sign extension happens on right sh ift /* It's implementation defined if sign extension happens on right sh ift
* of a signed int, hence the conditional (hopefully the compiler wi ll * of a signed int, hence the conditional (hopefully the compiler wi ll
* spot this and optimise it to a sign-extending shift on architectu res * spot this and optimise it to a sign-extending shift on architectu res
* with a suitable instruction). * with a suitable instruction).
*/ */
return (info >= 0) ? (info >> 15) : (~(~info >> 15)); #ifdef __GNUC__
// GCC 4.7.1 doesn't optimise the more complex expression down
// (reported as http://gcc.gnu.org/PR55299), but the documented
// behaviour for GCC is that right shift of a signed integer perform
s
// sign extension:
// http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Integers-implementati
on.html
return info >> 8;
#else
return (info >= 0) ? (info >> 8) : (~(~info >> 8));
#endif
} }
} }
/** Convert a single non-ASCII Unicode character to UTF-8. /** Convert a single non-ASCII Unicode character to UTF-8.
* *
* This is intended mainly as a helper method for to_utf8(). * This is intended mainly as a helper method for to_utf8().
* *
* @param ch The character (which must be > 128) to write to @a buf. * @param ch The character (which must be > 128) to write to @a buf.
* @param buf The buffer to write the character to - it must have * @param buf The buffer to write the character to - it must have
* space for (at least) 4 bytes. * space for (at least) 4 bytes.
 End of changes. 10 change blocks. 
11 lines changed or deleted 31 lines changed or added


 valueiterator.h   valueiterator.h 
/** @file valueiterator.h /** @file valueiterator.h
* @brief Class for iterating over document values. * @brief Class for iterating over document values.
*/ */
/* Copyright (C) 2008,2009,2010,2011 Olly Betts /* Copyright (C) 2008,2009,2010,2011,2012,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_VALUEITERATOR_H #ifndef XAPIAN_INCLUDED_VALUEITERATOR_H
#define XAPIAN_INCLUDED_VALUEITERATOR_H #define XAPIAN_INCLUDED_VALUEITERATOR_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/valueiterator.h> directly; include <xapian.h> in
stead."
#endif
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <xapian/attributes.h>
#include <xapian/derefwrapper.h> #include <xapian/derefwrapper.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <xapian/visibility.h> #include <xapian/visibility.h>
namespace Xapian { namespace Xapian {
/// Class for iterating over document values. /// Class for iterating over document values.
class XAPIAN_VISIBILITY_DEFAULT ValueIterator { class XAPIAN_VISIBILITY_DEFAULT ValueIterator {
void decref(); void decref();
skipping to change at line 58 skipping to change at line 63
ValueIterator(const ValueIterator & o); ValueIterator(const ValueIterator & o);
/// Assignment. /// Assignment.
ValueIterator & operator=(const ValueIterator & o); ValueIterator & operator=(const ValueIterator & o);
/** Default constructor. /** Default constructor.
* *
* Creates an uninitialised iterator, which can't be used before being * Creates an uninitialised iterator, which can't be used before being
* assigned to, but is sometimes syntactically convenient. * assigned to, but is sometimes syntactically convenient.
*/ */
ValueIterator() : internal(0) { } XAPIAN_NOTHROW(ValueIterator())
: internal(0) { }
/// Destructor. /// Destructor.
~ValueIterator() { ~ValueIterator() {
if (internal) decref(); if (internal) decref();
} }
/// Return the value at the current position. /// Return the value at the current position.
std::string operator*() const; std::string operator*() const;
/// Advance the iterator to the next position. /// Advance the iterator to the next position.
skipping to change at line 83 skipping to change at line 89
const std::string & value(**this); const std::string & value(**this);
operator++(); operator++();
return DerefWrapper_<std::string>(value); return DerefWrapper_<std::string>(value);
} }
/** Return the docid at the current position. /** Return the docid at the current position.
* *
* If we're iterating over values of a document, this method will thro w * If we're iterating over values of a document, this method will thro w
* Xapian::InvalidOperationError. * Xapian::InvalidOperationError.
*/ */
Xapian::docid get_docid() const; Xapian::docid get_docid() const XAPIAN_PURE_FUNCTION;
/** Return the value slot number for the current position. /** Return the value slot number for the current position.
* *
* If the iterator is over all values in a slot, this returns that slo t's * If the iterator is over all values in a slot, this returns that slo t's
* number. If the iterator is over the values in a particular documen t, * number. If the iterator is over the values in a particular documen t,
* it returns the number of each slot in turn. * it returns the number of each slot in turn.
*/ */
Xapian::valueno get_valueno() const; Xapian::valueno get_valueno() const XAPIAN_PURE_FUNCTION;
/** Advance the iterator to document id or value slot @a docid_or_slot. /** Advance the iterator to document id or value slot @a docid_or_slot.
* *
* If this iterator is over values in a document, then this method * If this iterator is over values in a document, then this method
* advances the iterator to value slot @a docid_or_slot, or the first slot * advances the iterator to value slot @a docid_or_slot, or the first slot
* after it if there is no value in slot @a slot. * after it if there is no value in slot @a slot.
* *
* If this iterator is over values in a particular slot, then this * If this iterator is over values in a particular slot, then this
* method advances the iterator to document id @a docid_or_slot, or th e * method advances the iterator to document id @a docid_or_slot, or th e
* first document id after it if there is no value in the slot we're * first document id after it if there is no value in the slot we're
skipping to change at line 140 skipping to change at line 146
* *
* Currently the inmemory and remote backends behave in the * Currently the inmemory and remote backends behave in the
* latter way because they don't support streamed values and so skip_t o() * latter way because they don't support streamed values and so skip_t o()
* must check each document it skips over which is significantly slowe r. * must check each document it skips over which is significantly slowe r.
* *
* @param docid The document id to check. * @param docid The document id to check.
*/ */
bool check(Xapian::docid docid); bool check(Xapian::docid docid);
/// Return a string describing this object. /// Return a string describing this object.
std::string get_description() const; std::string get_description() const XAPIAN_PURE_FUNCTION;
/** @private @internal ValueIterator is what the C++ STL calls an /** @private @internal ValueIterator is what the C++ STL calls an
* input_iterator. * input_iterator.
* *
* The following typedefs allow std::iterator_traits<> to work so that * The following typedefs allow std::iterator_traits<> to work so that
* this iterator can be used with the STL. * this iterator can be used with the STL.
* *
* These are deliberately hidden from the Doxygen-generated docs, as t he * These are deliberately hidden from the Doxygen-generated docs, as t he
* machinery here isn't interesting to API users. They just need to k now * machinery here isn't interesting to API users. They just need to k now
* that Xapian iterator classes are compatible with the STL. * that Xapian iterator classes are compatible with the STL.
skipping to change at line 166 skipping to change at line 172
typedef std::string value_type; typedef std::string value_type;
/// @private /// @private
typedef Xapian::doccount_diff difference_type; typedef Xapian::doccount_diff difference_type;
/// @private /// @private
typedef std::string * pointer; typedef std::string * pointer;
/// @private /// @private
typedef std::string & reference; typedef std::string & reference;
// @} // @}
}; };
bool
XAPIAN_NOTHROW(operator==(const ValueIterator &a, const ValueIterator &b));
/// Equality test for ValueIterator objects. /// Equality test for ValueIterator objects.
inline bool inline bool
operator==(const ValueIterator &a, const ValueIterator &b) operator==(const ValueIterator &a, const ValueIterator &b)
{ {
// Use a pointer comparison - this ensures both that (a == a) and corre ct // Use a pointer comparison - this ensures both that (a == a) and corre ct
// handling of end iterators (which we ensure have NULL internals). // handling of end iterators (which we ensure have NULL internals).
return a.internal == b.internal; return a.internal == b.internal;
} }
bool
XAPIAN_NOTHROW(operator!=(const ValueIterator &a, const ValueIterator &b));
/// Inequality test for ValueIterator objects. /// Inequality test for ValueIterator objects.
inline bool inline bool
operator!=(const ValueIterator &a, const ValueIterator &b) operator!=(const ValueIterator &a, const ValueIterator &b)
{ {
return !(a == b); return !(a == b);
} }
} }
#endif // XAPIAN_INCLUDED_VALUEITERATOR_H #endif // XAPIAN_INCLUDED_VALUEITERATOR_H
 End of changes. 9 change blocks. 
5 lines changed or deleted 18 lines changed or added


 valuesetmatchdecider.h   valuesetmatchdecider.h 
/** @file valuesetmatchdecider.h /** @file valuesetmatchdecider.h
* @brief MatchDecider subclass for filtering results by value. * @brief MatchDecider subclass for filtering results by value.
*/ */
/* Copyright 2008 Lemur Consulting Limited /* Copyright 2008 Lemur Consulting Ltd
* Copyright 2008,2009,2011 Olly Betts * Copyright 2008,2009,2011,2013 Olly Betts
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA * USA
*/ */
#ifndef XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H #ifndef XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H
#define XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H #define XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H
#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD
# error "Never use <xapian/valuesetmatchdecider.h> directly; include <xapia
n.h> instead."
#endif
#include <xapian/enquire.h> #include <xapian/enquire.h>
#include <xapian/types.h> #include <xapian/types.h>
#include <string> #include <string>
#include <set> #include <set>
namespace Xapian { namespace Xapian {
class Document; class Document;
 End of changes. 2 change blocks. 
2 lines changed or deleted 7 lines changed or added


 version.h   version.h 
/** @file version.h /** @file version.h
* @brief Define preprocesor symbols for the library version * @brief Define preprocessor symbols for the library version
*/ */
// Copyright (C) 2002,2004,2005,2006,2007,2008,2009,2010,2011 Olly Betts // Copyright (C) 2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013 Oll y Betts
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the // published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful // This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
skipping to change at line 46 skipping to change at line 46
#error was not compiled with this flag. The settings must match or your #error was not compiled with this flag. The settings must match or your
#error program will not work correctly. #error program will not work correctly.
#endif #endif
#endif #endif
#endif #endif
/// The library was compiled with GCC's -fvisibility=hidden option. /// The library was compiled with GCC's -fvisibility=hidden option.
#define XAPIAN_ENABLE_VISIBILITY #define XAPIAN_ENABLE_VISIBILITY
/// The version of Xapian as a C string literal. /// The version of Xapian as a C string literal.
#define XAPIAN_VERSION "1.3.0" #define XAPIAN_VERSION "1.3.1"
/** The major component of the Xapian version. /** The major component of the Xapian version.
* E.g. for Xapian 1.0.14 this would be: 1 * E.g. for Xapian 1.0.14 this would be: 1
*/ */
#define XAPIAN_MAJOR_VERSION 1 #define XAPIAN_MAJOR_VERSION 1
/** The minor component of the Xapian version. /** The minor component of the Xapian version.
* E.g. for Xapian 1.0.14 this would be: 0 * E.g. for Xapian 1.0.14 this would be: 0
*/ */
#define XAPIAN_MINOR_VERSION 3 #define XAPIAN_MINOR_VERSION 3
/** The revision component of the Xapian version. /** The revision component of the Xapian version.
* E.g. for Xapian 1.0.14 this would be: 14 * E.g. for Xapian 1.0.14 this would be: 14
*/ */
#define XAPIAN_REVISION 0 #define XAPIAN_REVISION 1
/// XAPIAN_HAS_BRASS_BACKEND Defined if the brass backend is enabled. /// XAPIAN_HAS_BRASS_BACKEND Defined if the brass backend is enabled.
#define XAPIAN_HAS_BRASS_BACKEND 1 #define XAPIAN_HAS_BRASS_BACKEND 1
/// XAPIAN_HAS_CHERT_BACKEND Defined if the chert backend is enabled. /// XAPIAN_HAS_CHERT_BACKEND Defined if the chert backend is enabled.
#define XAPIAN_HAS_CHERT_BACKEND 1 #define XAPIAN_HAS_CHERT_BACKEND 1
/// XAPIAN_HAS_INMEMORY_BACKEND Defined if the inmemory backend is enabled. /// XAPIAN_HAS_INMEMORY_BACKEND Defined if the inmemory backend is enabled.
#define XAPIAN_HAS_INMEMORY_BACKEND 1 #define XAPIAN_HAS_INMEMORY_BACKEND 1
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 weight.h   weight.h 
skipping to change at line 67 skipping to change at line 67
* *
* @param flag The stat_flags value for a required statistic. * @param flag The stat_flags value for a required statistic.
*/ */
void need_stat(stat_flags flag) { void need_stat(stat_flags flag) {
stats_needed = stat_flags(stats_needed | flag); stats_needed = stat_flags(stats_needed | flag);
} }
/** Allow the subclass to perform any initialisation it needs to. /** Allow the subclass to perform any initialisation it needs to.
* *
* @param factor Any scaling factor (e.g. from OP_SCALE_WEIGHT). * @param factor Any scaling factor (e.g. from OP_SCALE_WEIGHT).
* If the Weight object is for the term-independent
* weight supplied by get_sumextra()/get_maxextra(),
* then init(0.0) is called (starting from Xapian
* 1.2.11 and 1.3.1 - earlier versions failed to
* call init() for such Weight objects).
*/ */
virtual void init(double factor) = 0; virtual void init(double factor) = 0;
private: private:
/// Don't allow assignment. /// Don't allow assignment.
void operator=(const Weight &); void operator=(const Weight &);
/// A bitmask of the statistics this weighting scheme needs. /// A bitmask of the statistics this weighting scheme needs.
stat_flags stats_needed; stat_flags stats_needed;
skipping to change at line 98 skipping to change at line 103
/// The number of relevant documents which this term indexes. /// The number of relevant documents which this term indexes.
Xapian::doccount reltermfreq_; Xapian::doccount reltermfreq_;
/// The length of the query. /// The length of the query.
Xapian::termcount query_length_; Xapian::termcount query_length_;
/// The within-query-frequency of this term. /// The within-query-frequency of this term.
Xapian::termcount wqf_; Xapian::termcount wqf_;
/// An lower bound on the maximum length of any document in the databas e. /// A lower bound on the minimum length of any document in the database .
Xapian::termcount doclength_lower_bound_; Xapian::termcount doclength_lower_bound_;
/// An upper bound on the maximum length of any document in the databas e. /// An upper bound on the maximum length of any document in the databas e.
Xapian::termcount doclength_upper_bound_; Xapian::termcount doclength_upper_bound_;
/// An upper bound on the wdf of this term. /// An upper bound on the wdf of this term.
Xapian::termcount wdf_upper_bound_; Xapian::termcount wdf_upper_bound_;
public: public:
class Internal; class Internal;
skipping to change at line 292 skipping to change at line 297
/// The number of relevant documents which this term indexes. /// The number of relevant documents which this term indexes.
Xapian::doccount get_reltermfreq() const { return reltermfreq_; } Xapian::doccount get_reltermfreq() const { return reltermfreq_; }
/// The length of the query. /// The length of the query.
Xapian::termcount get_query_length() const { return query_length_; } Xapian::termcount get_query_length() const { return query_length_; }
/// The within-query-frequency of this term. /// The within-query-frequency of this term.
Xapian::termcount get_wqf() const { return wqf_; } Xapian::termcount get_wqf() const { return wqf_; }
/** An lower bound on the maximum length of any document in the databas e. /** An upper bound on the maximum length of any document in the databas e.
* *
* This should only be used by get_maxpart() and get_maxextra(). * This should only be used by get_maxpart() and get_maxextra().
*/ */
Xapian::termcount get_doclength_upper_bound() const { Xapian::termcount get_doclength_upper_bound() const {
return doclength_upper_bound_; return doclength_upper_bound_;
} }
/** An upper bound on the maximum length of any document in the databas /** A lower bound on the minimum length of any document in the database
e. .
*
* This bound does not include any zero-length documents.
* *
* This should only be used by get_maxpart() and get_maxextra(). * This should only be used by get_maxpart() and get_maxextra().
*/ */
Xapian::termcount get_doclength_lower_bound() const { Xapian::termcount get_doclength_lower_bound() const {
return doclength_lower_bound_; return doclength_lower_bound_;
} }
/** An upper bound on the wdf of this term. /** An upper bound on the wdf of this term.
* *
* This should only be used by get_maxpart() and get_maxextra(). * This should only be used by get_maxpart() and get_maxextra().
skipping to change at line 343 skipping to change at line 350
BoolWeight * unserialise(const std::string & s) const; BoolWeight * unserialise(const std::string & s) const;
double get_sumpart(Xapian::termcount wdf, double get_sumpart(Xapian::termcount wdf,
Xapian::termcount doclen) const; Xapian::termcount doclen) const;
double get_maxpart() const; double get_maxpart() const;
double get_sumextra(Xapian::termcount doclen) const; double get_sumextra(Xapian::termcount doclen) const;
double get_maxextra() const; double get_maxextra() const;
}; };
/// Xapian::Weight subclass implementing the tf-idf weighting scheme.
class XAPIAN_VISIBILITY_DEFAULT TfIdfWeight : public Weight {
/* Three character string indicating the normalizations for tf(wdf), id
f and
tfidf weight. */
std::string normalizations;
TfIdfWeight * clone() const;
void init(double factor);
/* When additional normalizations are implemented in the future, the ad
ditional statistics for them
should be accessed by these functions. */
double get_wdfn(Xapian::termcount wdf, char c) const;
double get_idfn(Xapian::doccount termfreq, char c) const;
double get_wtn(double wt, char c) const;
public:
/** Construct a TfIdfWeight
*
* @param normalizations A three character string indicating the norm
alizations
* to be used for the tf(wdf), idf and document
weight
* respectively.
*
* The first character specifies the normalizat
ion
* for the wdf for which the following normaliz
ations
* are currently available:
*
* 'n':None. wdfn=wdf
* 'b':Boolean wdfn=1 if term in document el
se wdfn=0
* 's':Square wdfn=wdf*wdf
* 'l':Logarithmic wdfn=1+log<sub>e</sub>(wdf)
*
* The Max-wdf and Augmented Max wdf normalizat
ions aren't yet implemented.
*
*
* The second character indicates the normaliza
tion
* for the idf, the following of which are curr
ently
* available:
*
* 'n':None idfn=1
* 't':TfIdf idfn=log(N/Termfreq) where N is t
he number of documents in
* collection and Termfreq is the nu
mber of documents which are
* indexed by the term t.
* 'p':Prob idfn=log((N-Termfreq)/Termfreq)
*
*
* The third and the final character indicates
the
* normalization for the document weight of whi
ch
* the following are currently available:
*
* 'n':None wtn=tfn*idfn
* Implementing more normalizations for the wei
ght requires access to
* statistics such as the weight of all terms i
n the document indexed by
* the term in the query. This is not available
from the current backend.
*
*
* More normalizations for all components can b
e implemented by
* changing the backend to acquire the statisti
cs
* required for the normalizations which are no
t
* currently available from Xapian::Weight.
*
*
* The default string is "ntn".
*/
explicit TfIdfWeight(const std::string &normalizations);
TfIdfWeight()
: normalizations("ntn")
{
need_stat(TERMFREQ);
need_stat(WDF);
need_stat(WDF_MAX);
need_stat(COLLECTION_SIZE);
}
std::string name() const;
std::string serialise() const;
TfIdfWeight * unserialise(const std::string & s) const;
double get_sumpart(Xapian::termcount wdf,
Xapian::termcount doclen) const;
double get_maxpart() const;
double get_sumextra(Xapian::termcount doclen) const;
double get_maxextra() const;
};
/// Xapian::Weight subclass implementing the BM25 probabilistic formula. /// Xapian::Weight subclass implementing the BM25 probabilistic formula.
class XAPIAN_VISIBILITY_DEFAULT BM25Weight : public Weight { class XAPIAN_VISIBILITY_DEFAULT BM25Weight : public Weight {
/// Factor to multiply the document length by. /// Factor to multiply the document length by.
mutable Xapian::doclength len_factor; mutable Xapian::doclength len_factor;
/// Factor combining all the document independent factors. /// Factor combining all the document independent factors.
mutable double termweight; mutable double termweight;
/// The BM25 parameters. /// The BM25 parameters.
double param_k1, param_k2, param_k3, param_b; double param_k1, param_k2, param_k3, param_b;
skipping to change at line 407 skipping to change at line 503
param_b = 0; param_b = 0;
} else if (param_b > 1) { } else if (param_b > 1) {
param_b = 1; param_b = 1;
} }
need_stat(COLLECTION_SIZE); need_stat(COLLECTION_SIZE);
need_stat(RSET_SIZE); need_stat(RSET_SIZE);
need_stat(TERMFREQ); need_stat(TERMFREQ);
need_stat(RELTERMFREQ); need_stat(RELTERMFREQ);
need_stat(WDF); need_stat(WDF);
need_stat(WDF_MAX); need_stat(WDF_MAX);
need_stat(WDF);
if (param_k2 != 0 || (param_k1 != 0 && param_b != 0)) { if (param_k2 != 0 || (param_k1 != 0 && param_b != 0)) {
need_stat(DOC_LENGTH_MIN); need_stat(DOC_LENGTH_MIN);
need_stat(AVERAGE_LENGTH); need_stat(AVERAGE_LENGTH);
} }
if (param_k1 != 0 && param_b != 0) need_stat(DOC_LENGTH); if (param_k1 != 0 && param_b != 0) need_stat(DOC_LENGTH);
if (param_k2 != 0) need_stat(QUERY_LENGTH); if (param_k2 != 0) need_stat(QUERY_LENGTH);
if (param_k3 != 0) need_stat(WQF); if (param_k3 != 0) need_stat(WQF);
} }
BM25Weight() BM25Weight()
: param_k1(1), param_k2(0), param_k3(1), param_b(0.5), : param_k1(1), param_k2(0), param_k3(1), param_b(0.5),
param_min_normlen(0.5) param_min_normlen(0.5)
{ {
need_stat(COLLECTION_SIZE); need_stat(COLLECTION_SIZE);
need_stat(RSET_SIZE); need_stat(RSET_SIZE);
need_stat(TERMFREQ); need_stat(TERMFREQ);
need_stat(RELTERMFREQ); need_stat(RELTERMFREQ);
need_stat(WDF); need_stat(WDF);
need_stat(WDF_MAX); need_stat(WDF_MAX);
need_stat(WDF);
need_stat(DOC_LENGTH_MIN); need_stat(DOC_LENGTH_MIN);
need_stat(AVERAGE_LENGTH); need_stat(AVERAGE_LENGTH);
need_stat(DOC_LENGTH); need_stat(DOC_LENGTH);
need_stat(WQF); need_stat(WQF);
} }
std::string name() const; std::string name() const;
std::string serialise() const; std::string serialise() const;
BM25Weight * unserialise(const std::string & s) const; BM25Weight * unserialise(const std::string & s) const;
skipping to change at line 476 skipping to change at line 570
TradWeight * clone() const; TradWeight * clone() const;
void init(double factor); void init(double factor);
public: public:
/** Construct a TradWeight. /** Construct a TradWeight.
* *
* @param k A non-negative parameter controlling how influential * @param k A non-negative parameter controlling how influential
* within-document-frequency (wdf) and document length are. * within-document-frequency (wdf) and document length are.
* k=0 means that wdf and document length don't affect the * k=0 means that wdf and document length don't affect the
* weights. The larger k1 is, the more they do. (default 1) * weights. The larger k is, the more they do. (default 1)
*/ */
explicit TradWeight(double k = 1.0) : param_k(k) { explicit TradWeight(double k = 1.0) : param_k(k) {
if (param_k < 0) param_k = 0; if (param_k < 0) param_k = 0;
if (param_k != 0.0) { if (param_k != 0.0) {
need_stat(AVERAGE_LENGTH); need_stat(AVERAGE_LENGTH);
need_stat(DOC_LENGTH); need_stat(DOC_LENGTH);
} }
need_stat(COLLECTION_SIZE); need_stat(COLLECTION_SIZE);
need_stat(RSET_SIZE); need_stat(RSET_SIZE);
need_stat(TERMFREQ); need_stat(TERMFREQ);
need_stat(RELTERMFREQ); need_stat(RELTERMFREQ);
need_stat(DOC_LENGTH_MIN); need_stat(DOC_LENGTH_MIN);
need_stat(WDF); need_stat(WDF);
need_stat(WDF_MAX); need_stat(WDF_MAX);
need_stat(WDF);
} }
std::string name() const; std::string name() const;
std::string serialise() const; std::string serialise() const;
TradWeight * unserialise(const std::string & s) const; TradWeight * unserialise(const std::string & s) const;
double get_sumpart(Xapian::termcount wdf, double get_sumpart(Xapian::termcount wdf,
Xapian::termcount doclen) const; Xapian::termcount doclen) const;
double get_maxpart() const; double get_maxpart() const;
 End of changes. 9 change blocks. 
8 lines changed or deleted 121 lines changed or added


 xapian.h   xapian.h 
/** @file xapian.h /** @file xapian.h
* @brief Public interfaces for the Xapian library. * @brief Public interfaces for the Xapian library.
*/ */
// Copyright (C) 2003,2004,2005,2007,2008,2009,2010 Olly Betts // Copyright (C) 2003,2004,2005,2007,2008,2009,2010,2012,2013 Olly Betts
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
#ifndef XAPIAN_INCLUDED_XAPIAN_H #ifndef XAPIAN_INCLUDED_XAPIAN_H
#define XAPIAN_INCLUDED_XAPIAN_H #define XAPIAN_INCLUDED_XAPIAN_H
#ifdef slots
# ifdef Q_OBJECT
// Qt headers '#define slots' by default, which clashes with us using it as
a
// class member name. Including <xapian.h> first is a simple workaround, o
r
// you can use 'no_keywords' to stop Qt polluting the global macro namespac
e,
// as described here:
//
// http://qt-project.org/doc/qt-5.0/signalsandslots.html#using-qt-with-3rd-
party-signals-and-slots
# error "Include <xapian.h> before Qt headers, or put 'CONFIG += no_keywor
ds' in your .pro file and use Q_SLOTS instead of slots, etc"
# endif
# ifdef WT_API
// Argh, copycat polluters!
# error "Include <xapian.h> before Wt headers, or define WT_NO_SLOT_MACROS
to stop Wt from defining the macros 'slots' and 'SLOT()'"
# endif
#endif
// Define so that deprecation warnings are given to API users, but not
// while building the library.
#define XAPIAN_IN_XAPIAN_H
// Set defines for library version and check C++ ABI versions match. // Set defines for library version and check C++ ABI versions match.
#include <xapian/version.h> #include <xapian/version.h>
// Types // Types
#include <xapian/types.h> #include <xapian/types.h>
// Function attributes
#include <xapian/attributes.h>
// Exceptions // Exceptions
#include <xapian/error.h> #include <xapian/error.h>
#include <xapian/errorhandler.h> #include <xapian/errorhandler.h>
// Access to databases, documents, etc. // Access to databases, documents, etc.
#include <xapian/database.h> #include <xapian/database.h>
#include <xapian/dbfactory.h> #include <xapian/dbfactory.h>
#include <xapian/document.h> #include <xapian/document.h>
#include <xapian/positioniterator.h> #include <xapian/positioniterator.h>
#include <xapian/postingiterator.h> #include <xapian/postingiterator.h>
skipping to change at line 85 skipping to change at line 108
namespace Xapian { namespace Xapian {
// Functions returning library version: // Functions returning library version:
/** Report the version string of the library which the program is linked wi th. /** Report the version string of the library which the program is linked wi th.
* *
* This may be different to the version compiled against (given by * This may be different to the version compiled against (given by
* XAPIAN_VERSION) if shared libraries are being used. * XAPIAN_VERSION) if shared libraries are being used.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
const char * version_string(); const char * XAPIAN_NOTHROW(version_string()) XAPIAN_CONST_FUNCTION;
/** Report the major version of the library which the program is linked wit h. /** Report the major version of the library which the program is linked wit h.
* *
* This may be different to the version compiled against (given by * This may be different to the version compiled against (given by
* XAPIAN_MAJOR_VERSION) if shared libraries are being used. * XAPIAN_MAJOR_VERSION) if shared libraries are being used.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
int major_version(); int XAPIAN_NOTHROW(major_version()) XAPIAN_CONST_FUNCTION;
/** Report the minor version of the library which the program is linked wit h. /** Report the minor version of the library which the program is linked wit h.
* *
* This may be different to the version compiled against (given by * This may be different to the version compiled against (given by
* XAPIAN_MINOR_VERSION) if shared libraries are being used. * XAPIAN_MINOR_VERSION) if shared libraries are being used.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
int minor_version(); int XAPIAN_NOTHROW(minor_version()) XAPIAN_CONST_FUNCTION;
/** Report the revision of the library which the program is linked with. /** Report the revision of the library which the program is linked with.
* *
* This may be different to the version compiled against (given by * This may be different to the version compiled against (given by
* XAPIAN_REVISION) if shared libraries are being used. * XAPIAN_REVISION) if shared libraries are being used.
*/ */
XAPIAN_VISIBILITY_DEFAULT XAPIAN_VISIBILITY_DEFAULT
int revision(); int XAPIAN_NOTHROW(revision()) XAPIAN_CONST_FUNCTION;
} }
#undef XAPIAN_IN_XAPIAN_H
#endif /* XAPIAN_INCLUDED_XAPIAN_H */ #endif /* XAPIAN_INCLUDED_XAPIAN_H */
 End of changes. 8 change blocks. 
5 lines changed or deleted 36 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/