--- xapian-core-1.0.7.orig/matcher/queryoptimiser.cc
+++ xapian-core-1.0.7/matcher/queryoptimiser.cc
@@ -1,7 +1,7 @@
 /** @file queryoptimiser.cc
  * @brief Convert a Xapian::Query::Internal tree into an optimal PostList tree.
  */
-/* Copyright (C) 2007 Olly Betts
+/* Copyright (C) 2007,2008 Olly Betts
  * Copyright (C) 2008 Lemur Consulting Ltd
  *
  * This program is free software; you can redistribute it and/or
@@ -245,7 +245,30 @@
     bool operator()(const PostList *a, const PostList *b) {
 	if (a->get_termfreq_max() == 0) return false;
 	if (b->get_termfreq_max() == 0) return true;
+
+#if defined(__i386__) || defined(__mc68000__)
+	// On some architectures, most common of which is x86, floating point
+	// values are calculated and stored in registers with excess precision.
+	// If the two get_maxweight() calls below return identical values in a
+	// register, the excess precision may be dropped for one of them but
+	// not the other (e.g. because the compiler saves the first calculated
+	// weight to memory while calculating the second, then reloads it to
+	// compare).  This leads to both a > b and b > a being true, which
+	// violates the antisymmetry property of the strict weak ordering
+	// required by nth_element().  This can have serious consequences (e.g.
+	// segfaults).
+	//
+	// To avoid this, we store each result in a volatile double prior to
+	// comparing them.  This means that the result of this test should
+	// match that on other architectures with the same double format (which
+	// is desirable), and actually has less overhead than rounding both
+	// results to float (which is another approach which works).
+	volatile double a_max_wt = a->get_maxweight();
+	volatile double b_max_wt = b->get_maxweight();
+	return a_max_wt > b_max_wt;
+#else
 	return a->get_maxweight() > b->get_maxweight();
+#endif
     }
 };
 
--- xapian-core-1.0.7.orig/backends/flint/flint_cursor.cc
+++ xapian-core-1.0.7/backends/flint/flint_cursor.cc
@@ -275,8 +275,11 @@
 
     B->del(current_key);
 
-    // The deletion happens in a new (uncommitted) revision of the tree, but
-    // the cursor is running over the previous revision, so it can still see
-    // the deleted key.
+    // If we're iterating an older revision of the tree, then the deletion
+    // happens in a new (uncommitted) revision and the cursor still sees
+    // the deleted key.  But if we're iterating the new uncommitted revision
+    // then the deleted key is no longer visible.  We need to handle both
+    // cases - either find_entry_ge() finds the deleted key or not.
+    if (!find_entry_ge(current_key)) return is_positioned;
     return next();
 }
--- xapian-core-1.0.7.orig/backends/flint/flint_table.cc
+++ xapian-core-1.0.7/backends/flint/flint_table.cc
@@ -1986,7 +1986,7 @@
 	    } else {
 		read_block(n, p);
 	    }
-	    if (REVISION(p) > 1) {
+	    if (REVISION(p) > revision_number + writable) {
 		set_overwritten();
 		return false;
 	    }
@@ -2038,7 +2038,7 @@
 	    } else {
 		read_block(n, p);
 	    }
-	    if (REVISION(p) > 1) {
+	    if (REVISION(p) > revision_number + writable) {
 		set_overwritten();
 		return false;
 	    }
--- xapian-core-1.0.7.orig/debian/control.in
+++ xapian-core-1.0.7/debian/control.in
@@ -0,0 +1,101 @@
+Source: xapian-core
+Section: libs
+Priority: optional
+Maintainer: Olly Betts <olly@survex.com>
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 4.1.22), autotools-dev, zlib1g-dev
+Homepage: http://xapian.org/
+
+Package: libxapian@LIBXAPIAN_SOVERSION@
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: xapian-tools
+Conflicts: libxapian2
+Description: Search engine library
+ This package contains the core Xapian runtime library.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: libxapian@LIBXAPIAN_DEV_SOVERSION@-dev
+Architecture: any
+Section: libdevel
+Depends: libxapian@LIBXAPIAN_SOVERSION@ (= @BINARY_VERSION@), libc6-dev | libc-dev, ${misc:Depends}
+Recommends: xapian-doc (= @BINARY_VERSION@), xapian-examples (= @BINARY_VERSION@)
+Description: Development files for Xapian search engine library
+ This package contains development libraries and headers for the core Xapian
+ library.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-tools
+Architecture: any
+Section: utils
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Basic tools for Xapian search engine library
+ This package contains several tools related to Xapian.
+  - copydatabase: Copy one or more Xapian databases.
+  - delve: Inspect the contents of a Xapian database.
+  - quartzcheck: Check the validity of a quartz-format Xapian database.
+  - quartzcompact: Compact a quartz database, or merge and compact several.
+  - quartzdump: Dump (part of) a quartz-format Xapian database.
+  - quest: Command line search of a Xapian database.
+  - xapian-check: Check the validity of a Xapian database.
+  - xapian-compact: Compact a quartz database, or merge and compact several.
+  - xapian-progsrv: stdin/stdout based server, for searching databases remotely.
+  - xapian-tcpsrv: TCP based server, used for searching databases remotely.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-doc
+Architecture: all
+Section: doc
+Recommends: libxapian@LIBXAPIAN_DEV_SOVERSION@-dev (= @BINARY_VERSION@)
+Description: Core Xapian documentation
+ This package contains general documentation about Xapian, and more detailed
+ API documentation.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-examples
+Architecture: any
+Section: doc
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libxapian@LIBXAPIAN_DEV_SOVERSION@-dev (= @BINARY_VERSION@)
+Description: Xapian simple example programs
+ This package contains source code for some example programs which use the
+ Xapian library.  The three "simple" examples are also included in binary
+ form; binaries for the other examples can be found in the xapian-tools
+ package (since they're useful tools in their own right).
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
--- xapian-core-1.0.7.orig/debian/control
+++ xapian-core-1.0.7/debian/control
@@ -0,0 +1,101 @@
+Source: xapian-core
+Section: libs
+Priority: optional
+Maintainer: Olly Betts <olly@survex.com>
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 4.1.22), autotools-dev, zlib1g-dev
+Homepage: http://xapian.org/
+
+Package: libxapian15
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: xapian-tools
+Conflicts: libxapian2
+Description: Search engine library
+ This package contains the core Xapian runtime library.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: libxapian-dev
+Architecture: any
+Section: libdevel
+Depends: libxapian15 (= ${binary:Version}), libc6-dev | libc-dev, ${misc:Depends}
+Recommends: xapian-doc (= ${binary:Version}), xapian-examples (= ${binary:Version})
+Description: Development files for Xapian search engine library
+ This package contains development libraries and headers for the core Xapian
+ library.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-tools
+Architecture: any
+Section: utils
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Basic tools for Xapian search engine library
+ This package contains several tools related to Xapian.
+  - copydatabase: Copy one or more Xapian databases.
+  - delve: Inspect the contents of a Xapian database.
+  - quartzcheck: Check the validity of a quartz-format Xapian database.
+  - quartzcompact: Compact a quartz database, or merge and compact several.
+  - quartzdump: Dump (part of) a quartz-format Xapian database.
+  - quest: Command line search of a Xapian database.
+  - xapian-check: Check the validity of a Xapian database.
+  - xapian-compact: Compact a quartz database, or merge and compact several.
+  - xapian-progsrv: stdin/stdout based server, for searching databases remotely.
+  - xapian-tcpsrv: TCP based server, used for searching databases remotely.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-doc
+Architecture: all
+Section: doc
+Recommends: libxapian-dev (= ${binary:Version})
+Description: Core Xapian documentation
+ This package contains general documentation about Xapian, and more detailed
+ API documentation.
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
+
+Package: xapian-examples
+Architecture: any
+Section: doc
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libxapian-dev (= ${binary:Version})
+Description: Xapian simple example programs
+ This package contains source code for some example programs which use the
+ Xapian library.  The three "simple" examples are also included in binary
+ form; binaries for the other examples can be found in the xapian-tools
+ package (since they're useful tools in their own right).
+ .
+ The Xapian search engine library is a highly adaptable toolkit to allow
+ developers to easily add advanced indexing and search facilities to their own
+ applications.  It implements the probabilistic model of information retrieval,
+ and provides facilities for performing ranked free-text searches, relevance
+ feedback, phrase searching, boolean searching, stemming, and simultaneous
+ update and searching.  It is highly scalable, and is capable of working with
+ collections containing hundreds of millions of documents.
--- xapian-core-1.0.7.orig/debian/libxapianVERSION-dev.install
+++ xapian-core-1.0.7/debian/libxapianVERSION-dev.install
@@ -0,0 +1,8 @@
+usr/bin/xapian-config
+usr/include/xapian.h
+usr/include/xapian
+usr/lib/libxapian.a
+usr/lib/libxapian.la
+usr/lib/libxapian.so
+usr/share/aclocal
+usr/share/man/man1/xapian-config.1
--- xapian-core-1.0.7.orig/debian/rules
+++ xapian-core-1.0.7/debian/rules
@@ -0,0 +1,216 @@
+#!/usr/bin/make -f
+#
+# Copyright (C) 2004,2005,2006 Lemur Consulting Ltd
+# Copyright (C) 2006,2007,2008 Olly Betts
+#
+# 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 the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+# USA
+
+# Codename we're building packages for.  If not explicitly specified, default
+# to that named in debian/codename and if that's not given, use "sid".
+CODENAME ?= $(shell cat debian/codename 2>/dev/null||echo sid)
+
+# ${binary:Version} was added after sarge and dapper, so use the old name for
+# it (${Source-Version}) there.
+ifneq ($(findstring .$(CODENAME)., .sarge.dapper.), )
+BINARY_VERSION := $${Source-Version}
+else
+BINARY_VERSION := $${binary:Version}
+endif
+
+# The soversion number needs to match that generated by libtool.  The following
+# lines should read configure.ac to get the current interface number and
+# subtract it from the interface age, to get the oldest interface number
+# supported by the library. This should correspond to the soversion assigned
+# to the library by libtool.  (This isn't documented, and is system dependent,
+# so we need to check it doesn't break with future versions of libtool.)
+libxapian_soversion:=$(shell sed 's/^LIBRARY_VERSION_INFO=\([0-9][0-9]*\):[0-9][0-9]*:\([0-9][0-9]*\).*/\1-\2/p;d' configure.ac)
+libxapian_soversion:=$(shell echo $$(($(libxapian_soversion))))
+
+# For now, we're only supporting installation of the latest development
+# files.  Changes to the API should be rare, so this seems reasonable.
+libxapian_dev_soversion=
+
+export DH_OPTIONS
+
+export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+    confflags += --build $(DEB_HOST_GNU_TYPE)
+    ifeq ($(DEB_HOST_ARCH), m68k)
+	# Disable the testsuite on m68k while we resolve why topercent2 is
+	# failing there.  It's a new regression test for a minor bug supposedly
+	# fixed in 1.0.7, so it's not like it actually worked any better in the
+	# currently installed 1.0.5-1 packages.
+	DEB_BUILD_OPTIONS += nocheck
+    endif
+else
+    confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+    # Disable the testsuite when cross-compiling.
+    DEB_BUILD_OPTIONS += nocheck
+endif
+
+# Handle DEB_BUILD_OPTIONS.  Note that dh_strip handles nostrip for us.
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+    confflags += CFLAGS=-O0 CXXFLAGS=-O0
+else
+    confflags += CFLAGS=-O2 CXXFLAGS=-O2
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    MAKEFLAGS += -j$(NUMJOBS)
+endif
+ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+    MAKE_CHECK := :
+else
+    MAKE_CHECK := $(MAKE) check
+endif
+
+commonconfflags := \
+	$(confflags) \
+	--prefix=/usr \
+	--sysconfdir=/etc
+
+# With GCC3 and later this won't make a huge difference, but it'll save
+# a bit of time and diskspace while building.
+commonconfflags += --disable-dependency-tracking
+
+maint: \
+	debian/control \
+	debian/libxapian$(libxapian_soversion).install \
+	debian/libxapian$(libxapian_dev_soversion)-dev.install
+
+maintclean: clean
+	rm -f debian/control
+	rm -f debian/libxapian$(libxapian_soversion).install
+	rm -f debian/libxapian$(libxapian_dev_soversion)-dev.install
+	rm -rf debian/libxapian$(libxapian_soversion)
+	rm -rf debian/libxapian$(libxapian_dev_soversion)-dev
+	rm -rf debian/xapian-doc
+	rm -rf debian/xapian-tools
+	rm -rf debian/tmp
+
+debian/control: debian/rules debian/control.in
+	rm -f debian/control.tmp
+	sed -e 's/@LIBXAPIAN_SOVERSION@/$(libxapian_soversion)/g' \
+	    -e 's/@LIBXAPIAN_DEV_SOVERSION@/$(libxapian_dev_soversion)/g' \
+	    -e 's/@BINARY_VERSION@/$(BINARY_VERSION)/g' \
+	     debian/control.in > debian/control.tmp
+	mv debian/control.tmp debian/control
+
+debian/libxapian$(libxapian_soversion).install: debian/rules debian/libxapianVERSION.install
+	cp -f debian/libxapianVERSION.install debian/libxapian$(libxapian_soversion).install
+
+debian/libxapian$(libxapian_dev_soversion)-dev.install: debian/rules debian/libxapianVERSION-dev.install
+	cp -f debian/libxapianVERSION-dev.install debian/libxapian$(libxapian_dev_soversion)-dev.install
+
+
+configure: configure-stamp
+configure-stamp: debian/control
+	dh_testdir
+
+	# Use the latest config.sub and config.guess from the autotools-dev
+	# package.
+	rm -f config.sub config.guess
+	ln -s /usr/share/misc/config.sub config.sub
+	ln -s /usr/share/misc/config.guess config.guess
+
+	# Report kernel and compiler version so upstream PLATFORMS file can be
+	# updated from buildd logs.
+	-uname -a
+	-g++ --version
+
+	# Configure in a subdirectory, for neatness.
+	mkdir -p build
+	cd build && ../configure $(commonconfflags)
+
+	# Touch the stamp file, to avoid repeating the configure step.
+	touch $@
+
+build: build-stamp
+build-stamp: configure
+	dh_testdir
+	$(MAKE) -C build
+	$(MAKE_CHECK) -C build
+	touch $@
+
+install: DH_OPTIONS=
+install: build \
+	 debian/libxapian$(libxapian_soversion).install \
+	 debian/libxapian$(libxapian_dev_soversion)-dev.install
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Install the files into debian/tmp
+	$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install
+
+	# Install the example source code
+	mkdir -p debian/tmp/usr/share/doc/xapian-examples/examples
+	cp examples/*.cc debian/tmp/usr/share/doc/xapian-examples/examples
+	ln -s ../../../../lib/xapian-examples/examples debian/tmp/usr/share/doc/xapian-examples/examples/built
+
+	# Reads the *.install files to decide where to install everything
+	dh_install --sourcedir=debian/tmp --fail-missing
+
+
+binary: binary-arch binary-indep
+binary-indep: DH_OPTIONS=-i
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+	dh_installman
+	dh_installchangelogs ChangeLog
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-arch: DH_OPTIONS=-a
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+	dh_installman
+	dh_installchangelogs ChangeLog
+	dh_strip
+	dh_link
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps -L libxapian$(libxapian_soversion) -ldebian/libxapian$(libxapian_soversion)/usr/lib
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+clean: debian/control
+	dh_testdir
+	dh_testroot
+	rm -rf build
+	rm -f config.sub config.guess
+	dh_clean
+	rm -f build-stamp configure-stamp
+
+.PHONY: maint maintclean configure build install binary binary-arch binary-indep clean
--- xapian-core-1.0.7.orig/debian/patch
+++ xapian-core-1.0.7/debian/patch
@@ -0,0 +1,84 @@
+Index: backends/flint/flint_cursor.cc
+===================================================================
+--- backends/flint/flint_cursor.cc (revision 9463)
++++ backends/flint/flint_cursor.cc (revision 11051)
+@@ -276,7 +276,10 @@
+     B->del(current_key);
+ 
+-    // The deletion happens in a new (uncommitted) revision of the tree, but
+-    // the cursor is running over the previous revision, so it can still see
+-    // the deleted key.
++    // If we're iterating an older revision of the tree, then the deletion
++    // happens in a new (uncommitted) revision and the cursor still sees
++    // the deleted key.  But if we're iterating the new uncommitted revision
++    // then the deleted key is no longer visible.  We need to handle both
++    // cases - either find_entry_ge() finds the deleted key or not.
++    if (!find_entry_ge(current_key)) return is_positioned;
+     return next();
+ }
+Index: backends/flint/flint_table.cc
+===================================================================
+--- backends/flint/flint_table.cc	(revision 10953)
++++ backends/flint/flint_table.cc	(revision 10954)
+@@ -1986,7 +1988,7 @@
+ 	    } else {
+ 		read_block(n, p);
+ 	    }
+-	    if (REVISION(p) > 1) {
++	    if (REVISION(p) > revision_number + writable) {
+ 		set_overwritten();
+ 		return false;
+ 	    }
+@@ -2038,7 +2041,7 @@
+ 	    } else {
+ 		read_block(n, p);
+ 	    }
+-	    if (REVISION(p) > 1) {
++	    if (REVISION(p) > revision_number + writable) {
+ 		set_overwritten();
+ 		return false;
+ 	    }
+Index: matcher/queryoptimiser.cc
+===================================================================
+--- matcher/queryoptimiser.cc	(revision 11483)
++++ matcher/queryoptimiser.cc	(revision 11484)
+@@ -1,7 +1,7 @@
+ /** @file queryoptimiser.cc
+  * @brief Convert a Xapian::Query::Internal tree into an optimal PostList tree.
+  */
+-/* Copyright (C) 2007 Olly Betts
++/* Copyright (C) 2007,2008 Olly Betts
+  * Copyright (C) 2008 Lemur Consulting Ltd
+  *
+  * This program is free software; you can redistribute it and/or
+@@ -245,7 +245,30 @@
+     bool operator()(const PostList *a, const PostList *b) {
+ 	if (a->get_termfreq_max() == 0) return false;
+ 	if (b->get_termfreq_max() == 0) return true;
++
++#if defined(__i386__) || defined(__mc68000__)
++	// On some architectures, most common of which is x86, floating point
++	// values are calculated and stored in registers with excess precision.
++	// If the two get_maxweight() calls below return identical values in a
++	// register, the excess precision may be dropped for one of them but
++	// not the other (e.g. because the compiler saves the first calculated
++	// weight to memory while calculating the second, then reloads it to
++	// compare).  This leads to both a > b and b > a being true, which
++	// violates the antisymmetry property of the strict weak ordering
++	// required by nth_element().  This can have serious consequences (e.g.
++	// segfaults).
++	//
++	// To avoid this, we store each result in a volatile double prior to
++	// comparing them.  This means that the result of this test should
++	// match that on other architectures with the same double format (which
++	// is desirable), and actually has less overhead than rounding both
++	// results to float (which is another approach which works).
++	volatile double a_max_wt = a->get_maxweight();
++	volatile double b_max_wt = b->get_maxweight();
++	return a_max_wt > b_max_wt;
++#else
+ 	return a->get_maxweight() > b->get_maxweight();
++#endif
+     }
+ };
+ 
--- xapian-core-1.0.7.orig/debian/compat
+++ xapian-core-1.0.7/debian/compat
@@ -0,0 +1 @@
+4
--- xapian-core-1.0.7.orig/debian/libxapian15.install
+++ xapian-core-1.0.7/debian/libxapian15.install
@@ -0,0 +1 @@
+usr/lib/libxapian.so.*
--- xapian-core-1.0.7.orig/debian/xapian-tools.install
+++ xapian-core-1.0.7/debian/xapian-tools.install
@@ -0,0 +1,22 @@
+usr/bin/copydatabase
+usr/bin/delve
+usr/bin/quartzcheck
+usr/bin/quartzcompact
+usr/bin/quartzdump
+usr/bin/quest
+usr/bin/xapian-check
+usr/bin/xapian-compact
+usr/bin/xapian-inspect
+usr/bin/xapian-progsrv
+usr/bin/xapian-tcpsrv
+usr/share/man/man1/copydatabase.1
+usr/share/man/man1/delve.1
+usr/share/man/man1/quartzcheck.1
+usr/share/man/man1/quartzcompact.1
+usr/share/man/man1/quartzdump.1
+usr/share/man/man1/quest.1
+usr/share/man/man1/xapian-check.1
+usr/share/man/man1/xapian-compact.1
+usr/share/man/man1/xapian-inspect.1
+usr/share/man/man1/xapian-progsrv.1
+usr/share/man/man1/xapian-tcpsrv.1
--- xapian-core-1.0.7.orig/debian/codename
+++ xapian-core-1.0.7/debian/codename
@@ -0,0 +1 @@
+etch
--- xapian-core-1.0.7.orig/debian/libxapian-dev.install
+++ xapian-core-1.0.7/debian/libxapian-dev.install
@@ -0,0 +1,8 @@
+usr/bin/xapian-config
+usr/include/xapian.h
+usr/include/xapian
+usr/lib/libxapian.a
+usr/lib/libxapian.la
+usr/lib/libxapian.so
+usr/share/aclocal
+usr/share/man/man1/xapian-config.1
--- xapian-core-1.0.7.orig/debian/xapian-examples.install
+++ xapian-core-1.0.7/debian/xapian-examples.install
@@ -0,0 +1,2 @@
+usr/share/doc/xapian-examples/examples
+usr/bin/simple* usr/lib/xapian-examples/examples
--- xapian-core-1.0.7.orig/debian/xapian-doc.doc-base.apidocs
+++ xapian-core-1.0.7/debian/xapian-doc.doc-base.apidocs
@@ -0,0 +1,12 @@
+Document: xapian-apidocs
+Title: API documentation for Xapian
+Abstract: This manual describes the native C++ API of the Xapian
+ search engine library.
+Section: Programming/C++
+
+Format: PDF
+Files: /usr/share/doc/xapian-doc/apidoc.pdf*
+
+Format: HTML
+Index: /usr/share/doc/xapian-doc/apidoc/html/index.html
+Files: /usr/share/doc/xapian-doc/apidoc/html/*.html
--- xapian-core-1.0.7.orig/debian/changelog
+++ xapian-core-1.0.7/debian/changelog
@@ -0,0 +1,418 @@
+xapian-core (1.0.7-4~bpo40+1) etch-backports; urgency=low
+
+  * Rebuild for etch-backports.
+  * Set debian/codename to "etch".
+
+ -- Chris Lamb <lamby@debian.org>  Mon, 17 Nov 2008 14:00:12 +0000
+
+xapian-core (1.0.7-4) unstable; urgency=low
+
+  * debian/patch: Backport fix from upstream SVN which fixes segfaults when
+    using OP_ELITE_SET on x86 and possibly m68k due to excess precision
+    causing a comparison operator to report true for both a>b and b>a.
+
+ -- Olly Betts <olly@survex.com>  Thu, 09 Oct 2008 12:58:25 +0100
+
+xapian-core (1.0.7-3~bpo40+1) etch-backports; urgency=low
+
+  * Rebuild for etch-backports.
+  * No changes to source package except changelog.
+
+ -- Chris Lamb <lamby@debian.org>  Wed, 12 Nov 2008 15:48:50 +0000
+
+xapian-core (1.0.7-3) unstable; urgency=low
+
+  * debian/rules: Run "make all" and "make check" as separate commands to
+    avoid hitting parallel building bugs.  Closes: #493390
+  * debian/patch: Backport fixes for upstream bug #287 (which can cause
+    database corruption), and a bug without a ticket which causes problems
+    iterating over tables created lazily after the database has had commits
+    which are still in sequential mode.
+
+ -- Olly Betts <olly@survex.com>  Fri,  8 Aug 2008 09:46:20 +0100
+
+xapian-core (1.0.7-2) unstable; urgency=low
+
+  * debian/rules: Fix configure and build rules to be parallel make safe
+    (caused FTBFS on s390 buildd).
+  * debian/rules: Temporarily disable the testsuite on m68k while we resolve
+    why topercent2 is failing there.  It's a new regression test for a minor
+    bug supposedly fixed in 1.0.7, so it's not like it actually worked any
+    better in the currently installed 1.0.5-1 packages.
+
+ -- Olly Betts <olly@survex.com>  Tue, 29 Jul 2008 11:50:35 +0100
+
+xapian-core (1.0.7-1) unstable; urgency=low
+
+  * New upstream release.
+    + Add "nl" for selecting the Dutch stemmer, which was accidentally missing
+      from the list of language codes recognised.  Reported by Joey Hess.
+      Closes: #484458
+  * debian/copyright: Update for 2008 and a few other minor changes.
+  * debian/control.in: Add "${shlibs:Depends}, ${misc:Depends}" to "Depends"
+    to fix a policy violation (dependencies will pull them in anyway so this
+    hasn't caused problems in practice).  Omission noticed by Niko Tyni.
+  * debian/control.in: Move libxapianNN-dev from "Depends" to "Recommends"
+    for xapian-examples since it's not actually needed to run the built
+    examples.
+  * debian/rules: Add support for parallel=<n> in DEB_BUILD_OPTIONS, as
+    recommended by policy 3.8.0.  Use $(filter ...) instead of $(find ...)
+    to check for noopt in DEB_BUILD_OPTIONS to avoid false matches on
+    substrings of non-standard options (e.g. snooptables).
+  * debian/rules: Run the xapian-core testsuite unless nocheck is specified
+    in DEB_BUILD_OPTIONS.  It takes 3.5 minutes on x86-64, so hopefully
+    shouldn't be too painful for slower architectures.
+  * debian/control.in: Standards-Version: 3.8.0
+  * debian/watch: Add watch file.  Not useful for me as I make the upstream
+    releases, but DEHS, etc find it useful.
+  * debian/xapian-doc.doc-base.apidocs: Section "Apps/Programming" is no
+    longer valid - use section "Programming/C++" instead.
+  * debian/xapian-doc.doc-base.xapian-intro: Section "Apps/Programming" is no
+    longer valid - use section "Programming" instead.
+
+ -- Olly Betts <olly@survex.com>  Wed, 23 Jul 2008 10:30:49 +0100
+
+xapian-core (1.0.5-1) unstable; urgency=low
+
+  * New upstream release.
+    + Fixes compilation with latest GCC 4.3 snapshot.  Closes: #455151
+    + No longer installs ".map" files with documentation, which fixes lintian
+      warning about an empty file in the documentation.
+  * debian/rules: Look for "CODENAME" and "debian/codename" rather than
+    "COMPONENT" and "debian/component".
+  * debian/control.in: Standards-Version: 3.7.3 (no changes required).
+  * debian/control.in: The "Homepage:" header is now official, so convert
+    "Homepage:" pseudo-headers.
+
+ -- Olly Betts <olly@survex.com>  Sat, 22 Dec 2007 21:37:09 +0000
+
+xapian-core (1.0.4-1) unstable; urgency=low
+
+  * New upstream release.  Closes: #444858
+    + Fixes compilation with latest GCC 4.3 snapshot.  Closes: #441618
+  * debian/control.in,debian/rules: Use "${binary:Version}" instead of
+    "${Source-Version}" (except on sarge and dapper which predate
+    "${binary:Version}").
+
+ -- Olly Betts <olly@survex.com>  Fri,  2 Nov 2007 03:15:23 +0000
+
+xapian-core (1.0.2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Olly Betts <olly@survex.com>  Thu,  5 Jul 2007 01:06:06 +0100
+
+xapian-core (1.0.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Olly Betts <olly@survex.com>  Mon, 11 Jun 2007 16:51:38 +0100
+
+xapian-core (1.0.0-1) unstable; urgency=low
+
+  * New upstream release.
+    + Now builds with GCC 4.3 snapshot.  Closes: #417778
+  * debian/rules: Generate control from control.in robustly - don't risk
+    leaving a partially generated destination file.
+  * debian/patch: Changes included upstream so remove.
+  * debian/xapian-tools.install: Package new xapian-check tool and its manpage.
+  * debian/control.in: Mention new xapian-check and previously overlooked
+    xapian-progsrv.  Make it clear that quartzXXX is for quartz-format
+    databases.
+  * debian/copyright: Update.
+  * debian/rules: We don't need to pass --mandir or --infodir to configure
+    as the values we explicitly set are the defaults anyway (and we don't
+    have any documentation in "info" format).
+  * debian/control.in: Add "zlib1g-dev" to "Build-Depends:".
+
+ -- Olly Betts <olly@survex.com>  Tue, 29 May 2007 16:37:31 +0100
+
+xapian-core (0.9.9-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/xapian-tools.install: Install xapian-progsrv.1 man page.
+  * debian/patch: Fix WritableDatabase::replace_document() bug where replacing
+    a document with itself with unmodified postings loses all positional
+    information for that document.
+
+ -- Olly Betts <olly@survex.com>  Wed, 15 Nov 2006 01:03:02 +0000
+
+xapian-core (0.9.8-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/xapian-doc.doc-base.apidocs: The printable API documentation is now
+    a PDF rather than PostScript.
+
+ -- Olly Betts <olly@survex.com>  Sat,  4 Nov 2006 12:27:01 +0000
+
+xapian-core (0.9.7-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/xapian-tools.install: Install /usr/bin/xapian-progsrv.
+  * debian/copyright: Add Richard Boulton.
+
+ -- Olly Betts <olly@survex.com>  Wed, 11 Oct 2006 17:44:47 +0100
+
+xapian-core (0.9.6-5) unstable; urgency=low
+
+  * debian/control.in: Remove "designed to be" from the package description at
+    Wookey's suggestion.
+  * debian/control.in: Add extra space before "Homepage:" as is recommended
+    by the Debian Developer's Reference.
+
+ -- Olly Betts <olly@survex.com>  Sun,  9 Jul 2006 02:03:19 +0100
+
+xapian-core (0.9.6-4) unstable; urgency=low
+
+  * debian/copyright: Update with a thorough list of copyrights and licences.
+
+ -- Olly Betts <olly@survex.com>  Mon, 26 Jun 2006 16:00:12 +0100
+
+xapian-core (0.9.6-3) unstable; urgency=low
+
+  * debian/control: Updated description:
+    + The queryparser is no longer a separate library.
+    + The claimed scalability was overly modest - we can certainly handle
+      "hundreds of millions of documents".
+    + Add a link to the homepage.
+
+ -- Olly Betts <olly@survex.com>  Thu, 15 Jun 2006 04:14:49 +0100
+ 
+xapian-core (0.9.6-2) unstable; urgency=low
+
+  * dh_strip handles nostrip in DEB_BUILD_OPTIONS for us, so there's no
+    need to check by hand.
+  * configure with --disable-dependency-tracking which will save us some
+    diskspace and a little time during the build.
+
+ -- Olly Betts <olly@survex.com>  Fri,  9 Jun 2006 02:29:10 +0100
+ 
+xapian-core (0.9.6-1) unstable; urgency=low
+
+  * New upstream release.
+  * "Standards-Version: 3.7.2" - no changes required.
+
+ -- Olly Betts <olly@survex.com>  Mon, 15 May 2006 21:20:07 +0100
+ 
+xapian-core (0.9.5-3) unstable; urgency=low
+
+  * Create xapian-examples package.
+
+ -- Olly Betts <olly@survex.com>  Wed, 12 Apr 2006 04:14:51 +0100
+
+xapian-core (0.9.5-2) unstable; urgency=low
+
+  * Use debian/compat instead of setting DH_COMPAT.
+  * dh_install with --fail-missing intead of just --list-missing.
+  * dh_install now explicitly excludes the simple* examples.
+
+ -- Olly Betts <olly@survex.com>  Sun,  9 Apr 2006 21:17:32 +0100
+
+xapian-core (0.9.5-1) unstable; urgency=low
+
+  * New upstream release.
+    + All installed binaries now have man pages.
+  * "Standards-Version: 3.6.2" - no changes required.
+  * debian/copyright: Update FSF address and give download URL for releases
+    instead of obsolete CVS location.
+  * debian/control.in: copydatabase and xapian-compact are packaged in
+    xapian-tools, so add them to the list of tools in the package description.
+  * debian/rules: Increase DH_COMPAT from 3 to 4.
+  * debian/TODO: Updated.
+  * New maintainer.
+
+ -- Olly Betts <olly@survex.com>  Sun,  9 Apr 2006 00:41:22 +0100
+
+xapian-core (0.9.4-3) unstable; urgency=low
+
+  * Add new header "deprecated.h"
+
+ -- Richard Boulton <richard@tartarus.org>  Fri,  3 Mar 2006 02:59:10 +0000
+
+xapian-core (0.9.4-2) unstable; urgency=low
+
+  * Fix invalid date line in previous changelog entry. 
+
+ -- Richard Boulton <richard@tartarus.org>  Fri,  3 Mar 2006 02:33:08 +0000
+
+xapian-core (0.9.4-1) unstable; urgency=low
+
+  * New upstream release.
+  * A couple of small, but important, fixes.
+
+ -- Richard Boulton <richard@tartarus.org>  Fri,  3 Mar 2006 02:31:23 +0000
+
+xapian-core (0.9.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * API additions: some new functions to get version information, useful
+    when using a shared library of Xapian.
+  * Query parser bug fix with "+" terms when default op is AND.
+  * Query parser supports "AND NOT" as a synonym for "NOT".
+  * Various bug fixes - some errors threw unhelpful exception types. 
+  * Use updated versions of automake and libtool.
+  * Various documentation, debug and packaging updates.
+
+ -- Richard Boulton <richard@tartarus.org>  Thu, 16 Feb 2006 12:59:27 +0000
+
+xapian-core (0.9.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * API modifications to queryparser.
+  * "flint" database backend now claimed to be functional.
+  * Many bug-fixes.
+
+ -- Richard Boulton <richard@tartarus.org>  Fri, 15 Jul 2005 12:56:43 +0100
+
+xapian-core (0.9.1-2) unstable; urgency=low
+
+  * Add new header xapian/dbfactory.h
+  * Add delve and quest to xapian-tools package. 
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 15 Jun 2005 10:45:17 +0100
+
+xapian-core (0.9.1-1) unstable; urgency=low
+
+  * New upstream release.  (Version 0.9.0 never got packaged.)
+  * Various API changes - see NEWS file for details.
+  * No longer Build-Depend on bison - we now use lemon, and use the copy
+    of lemon in the Xapian source tree.
+
+ -- Richard Boulton <richard@tartarus.org>  Tue,  7 Jun 2005 07:31:29 +0100
+
+xapian-core (0.8.5-1) unstable; urgency=low
+
+  * New upstream release.
+  * xapian-config: --libs output fixed to not include libxapian.la
+  * quartzcompact: Added --no-full / -n option to disable full compaction,
+    fix largefile support, slight increase in compaction efficiency, slight
+    change in statistics reporting formatting.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed,  5 Jan 2005 11:42:51 +0000
+
+xapian-core (0.8.4-1) unstable; urgency=low
+
+  * New upstream release.
+  * API changes: 
+    - Added constructors to Database and WritableDatabase.
+      Auto::open() is now deprecated.
+    - Removed the ability to write a Xapian object to an ostream directly.
+    - Renamed BM25 parameters to match standard naming in papers and elsewhere.
+  * Library version number increased from 3 to 5 due to interface changes.
+  * Some bug and portability fixes.
+
+ -- Richard Boulton <richard@tartarus.org>  Thu,  9 Dec 2004 17:30:31 +0000
+
+xapian-core (0.8.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Fixed bug which caused a segmentation fault or odd "Document not found"
+    exceptions when new check_at_least parameter to Enquire::get_mset() was
+    used and there weren't many matches (regression test checkatleast1).
+  * omtcpsrv renamed to xapian-tcpsrv.
+
+ -- Richard Boulton <richard@tartarus.org>  Tue, 21 Sep 2004 13:30:17 +0100
+
+xapian-core (0.8.2-3) unstable; urgency=low
+
+  * Make libxapian3 conflict with libxapian2, because libxapian2 version
+    0.8.1-1 actually contained libxapian.so.3 (which was a bug).
+
+ -- Richard Boulton <richard@tartarus.org>  Tue, 14 Sep 2004 17:34:43 +0100
+
+xapian-core (0.8.2-2) unstable; urgency=low
+
+  * Oops - library version number should be 3.  Changed it back,
+    so we now have libxapian3.
+    (I was confused between the interface number and the version number.)
+
+ -- Richard Boulton <richard@tartarus.org>  Tue, 14 Sep 2004 16:44:37 +0100
+
+xapian-core (0.8.2-1) unstable; urgency=low
+
+  * New upstream release (0.8.2).
+  * library version number increased to 4 (from 2).
+    (Xapian::Database::get_lastdocid added; QueryParser tries
+    reparsing after stripping punctuation; several unused
+    Error subclasses removed; assorted Iterator changes,
+    Xapian::ESet::back and many other methods added).
+
+ -- Richard Boulton <richard@tartarus.org>  Tue, 14 Sep 2004 01:03:49 +0100
+
+xapian-core (0.8.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 30 Jun 2004 20:10:05 +0100
+
+xapian-core (0.8.0-9) unstable; urgency=low
+
+  * Remove build dependencies on tools which aren't required if not using
+    maintainer mode.
+
+ -- Richard Boulton <richard@tartarus.org>  Thu, 27 May 2004 00:37:02 +0100
+
+xapian-core (0.8.0-8) unstable; urgency=low
+
+  * Fix minor bugs in debian/rules (trailing backslashes, and missing -p
+    from mkdir)
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 19 May 2004 13:33:02 +0100
+
+xapian-core (0.8.0-7) unstable; urgency=low
+
+  * Perform build in a subdirectory.  This is neater, and will also make it
+    easier to perform a differently configured build to produce a debug
+    version.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 19 May 2004 12:13:45 +0100
+
+xapian-core (0.8.0-6) unstable; urgency=low
+
+  * debian/rules,debian/control.in: Remove queryparser packages - merge
+    them into the main library package.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 19 May 2004 01:44:58 +0100
+
+xapian-core (0.8.0-5) unstable; urgency=low
+
+  * debian/rules: Add --list-missing back to dh_install.
+  * debian/control.in: Remove build depend on graphviz, and add TODO item
+    to sort this out properly.
+    Also, build depend on debhelper >= 4.1.22, since this is needed for
+    --list-missing.
+  
+ -- Richard Boulton <richard@tartarus.org>  Wed, 12 May 2004 11:59:42 +0100
+
+xapian-core (0.8.0-4) unstable; urgency=low
+
+  * xapian-doc: Correct Recommends field to point to libxapian-dev, not
+    libxapian2-dev, and to libxapian-queryparser-dev not
+    libxapian-queryparser1-dev.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 12 May 2004 10:36:16 +0100
+
+xapian-core (0.8.0-3) unstable; urgency=low
+
+  * Remove empty maintainer scripts, allowing debhelper to make them.
+  * Add rules to make symlinks to config.guess and config.sub, and added
+    Build-Depends on autotools-dev.  Remove Build-Depends on automake,
+    autoconf and libtool (these will be run before the source package is
+    generated).
+  * Add some more items to TODO list.
+
+ -- Richard Boulton <richard@tartarus.org>  Wed, 12 May 2004 09:48:34 +0100
+
+xapian-core (0.8.0-2) unstable; urgency=low
+
+  * Fixed postinst, postrm, and prerm scripts to have a #!/bin/sh line, so
+    they actually work.
+  * Various tweaks to debian/rules suggested by looking at dh_make output. 
+
+ -- Richard Boulton <richard@tartarus.org>  Tue, 11 May 2004 17:00:03 +0100
+
+xapian-core (0.8.0-1) unstable; urgency=low
+
+  * Initial release, from upstream source snapshot.
+
+ -- Richard Boulton <richard@tartarus.org>  Sun,  9 May 2004 16:28:37 +0100
--- xapian-core-1.0.7.orig/debian/watch
+++ xapian-core-1.0.7/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://xapian.org/download http://oligarchy.co.uk/xapian/([\d.]+)/xapian-core-\1\.tar\.gz
--- xapian-core-1.0.7.orig/debian/libxapianVERSION.install
+++ xapian-core-1.0.7/debian/libxapianVERSION.install
@@ -0,0 +1 @@
+usr/lib/libxapian.so.*
--- xapian-core-1.0.7.orig/debian/TODO
+++ xapian-core-1.0.7/debian/TODO
@@ -0,0 +1,13 @@
+A section 3 man page should be written to describe libxapian (see the libxml
+manpage for example.)
+
+We should also produce a libxapian-dbg package, containing a debug build of
+the library.  Not entirely clear which debugging options we should use:
+perhaps --enable-assertions --enable-log
+
+xapian-doc: in index.html, there is one broken link (which occurs in two
+places, pointing to the "internal classes" documentation, since we don't
+generate this by default).  We could move this to point to the Xapian website.
+There should almost certainly be a link back to the front page of the Xapian
+website, too.  The documentation should also probably be in the style of the
+Xapian website, and should use the Xapian logo on the front page.
--- xapian-core-1.0.7.orig/debian/xapian-doc.doc-base.xapian-intro
+++ xapian-core-1.0.7/debian/xapian-doc.doc-base.xapian-intro
@@ -0,0 +1,9 @@
+Document: xapian-intro
+Title: Introductory documents about Xapian
+Abstract: These documents give an introduction to the Xapian
+ search engine library, and how to use it.
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/xapian-doc/index.html
+Files: /usr/share/doc/xapian-doc/*.html
--- xapian-core-1.0.7.orig/debian/copyright
+++ xapian-core-1.0.7/debian/copyright
@@ -0,0 +1,132 @@
+This is the Debian package of the Xapian search engine library.  This
+package was originally created and maintained by Richard Boulton
+<richard@tartarus.org>.  It is currently maintained by Olly Betts
+<olly@survex.com>.
+
+It was downloaded from http://xapian.org/download
+
+Upstream Authors:
+
+        Olly Betts <olly@survex.com>
+        Hein Ragas <hragas@users.sourceforge.net>
+        Sam Liddicott <samjam@users.sourceforge.net>
+	Ananova Ltd
+	Orange PCS Ltd
+	BrightStation PLC
+	Dr Martin Porter
+	Free Software Foundation, Inc.
+	Silicon Graphics Computer Systems, Inc.
+	Richard Boulton
+	Lemur Consulting Ltd
+
+Copyright:
+
+  Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Olly Betts
+  Copyright (C) 2003 Sam Liddicott
+  Copyright (C) 2001,2002 Ananova Ltd
+  Copyright (C) 2003 Orange PCS Ltd
+  Copyright (C) 1999,2000,2001 BrightStation PLC
+  Copyright (C) 2001 Hein Ragas
+  Copyright (C) 2003,2006 Richard Boulton
+  Copyright (C) 2007,2008 Lemur Consulting Ltd
+
+  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 the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+  See /usr/share/common-licenses/GPL for the full text of the GNU GPL.
+
+The snowball sources in the languages subdirectory are licensed under
+the three clause BSD license:
+
+  Copyright (c) 2001, Dr Martin Porter
+  Copyright (c) 2004,2005, Richard Boulton
+  Copyright (c) 2006,2007, Olly Betts
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * The name of the author may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+The file common/autoptr.h is taken from GCC and bears the following
+licence statements:
+
+  Copyright (C) 2001 Free Software Foundation, Inc.
+ 
+  This file is part of the GNU ISO C++ Library.  This library is free
+  software; you can redistribute it and/or modify it under the
+  terms of the GNU General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with this library; see the file COPYING.  If not, write to the Free
+  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  02110-1301 USA.
+
+  As a special exception, you may use this file as part of a free software
+  library without restriction.  Specifically, if other files instantiate
+  templates or use macros or inline functions from this file, or you compile
+  this file and link it with other files to produce an executable, this
+  file does not by itself cause the resulting executable to be covered by
+  the GNU General Public License.  This exception does not however
+  invalidate any other reasons why the executable file might be covered by
+  the GNU General Public License.
+
+  Copyright (c) 1997-1999
+  Silicon Graphics Computer Systems, Inc.
+ 
+  Permission to use, copy, modify, distribute and sell this software
+  and its documentation for any purpose is hereby granted without fee,
+  provided that the above copyright notice appear in all copies and
+  that both that copyright notice and this permission notice appear
+  in supporting documentation.  Silicon Graphics makes no
+  representations about the suitability of this software for any
+  purpose.  It is provided "as is" without express or implied warranty.
+ 
+The files queryparser/lemon.c and queryparser/queryparser.lt (which are
+a parser generator and its output template file) bear the following
+statements respectively:
+
+  The authors of this program disclaim copyright.
+
+  The author disclaims copyright to this source code.
+
+The Debian packaging is also licensed under the GPL v2 or later (see above)
+and the copyright details are:
+
+  Copyright (C) 2004,2005,2006 Lemur Consulting Ltd
+  Copyright (C) 2006,2007,2008 Olly Betts
--- xapian-core-1.0.7.orig/debian/xapian-doc.install
+++ xapian-core-1.0.7/debian/xapian-doc.install
@@ -0,0 +1 @@
+usr/share/doc/xapian-core/* usr/share/doc/xapian-doc
