Xapian-core 1.4.27 (2024-12-06): testsuite: * Fix testcase unsupportedcheck1 for --disable-backend-remote. Reported by Matthieu Gautier in #832. * Merge testcases unsupportedcheck1 and stubdb9 which are essentially the same testcase! build system: * Fix build with --disable-backend-chert. Patch from Matthieu Gautier in #832. portability: * Add missing include of to fix build failure on macOS 15. Xapian-core 1.4.26 (2024-07-18): API: * Weight: Document that Weight statistics DOC_LENGTH_MIN, DOC_LENGTH_MAX and WDF_MAX are for the shard rather than the whole database. Usually this is what we want as with a sharded database it gives tighter bounds and so better match optimisation, but it does make them unsuitable for uses such as calculating a suitable offset to add to every get_sumextra() to allow implementing a weighting formula which can give a negative term independent weight contribution. This case will be addressed in the next release series which also provides bounds such as DB_DOC_LENGTH_MIN which are for the whole database. * LMWeight: This class was meant to implement the "Language Model" Weighting scheme, but we've discovered the implementation was incorrect and fixing it requires ABI-incompatible changes. For 1.4.x we need to leave it in place so as not to break existing code, but it's now deprecated and we recommend avoiding using it. It will be removed in the next release series and replaced with new separate classes implementing Language Model weighting with each smoothing. Thanks to Sourav Saha for reporting this problem. * PL2PlusWeight: Fix bug in implementation of formula. Our variable mean is 1/lambda_t from the PL2+ paper, so we need to check mean>1 for lambda_t<1 but we were actually checking mean<1 instead. The result of this is that PL2+ actually returned a zero weight unless the term occurred frequently enough in the collection. * TradWeight::get_maxpart() no longer forces the wdf_max value to be at least one. We used to do this so that a non-existent term in the query would cause it not to achieve 100%, but now we calculate percentages based on the number of matching subqueries, and it is more natural for a non-existent term to get zero weight (ditto for a term which always has wdf 0). This was already addressed for BM25Weight in 1.2.1 back in 2010. * Enquire::set_expansion_scheme(): Add "prob" as new preferred name for probabilistic query expansion, with the previous "trad" still being accepted for now. * QueryParser::set_prefix() and set_boolean_prefix(): Allow an optional trailing `:` on the field name. This makes the API here more consistent with ranges, where you need to include the `:` if you want one. See #720. testsuite: * Catch and report if a testcase causes signal SIGPIPE. * Suppress valgrind errors about calling memmove() with overlapping source and destination (which is valid, valgrind is just confused when memcpy() and memmove() share an implementation). * Add more testing of weighting schemes. * Mark checkstatsweight3 with a sharded database as XFAIL (expected to fail). This testcase was previous not run for sharded databases, with a FIXME comment noting this. Investigating shows it's due to a bug where we use the shard's termfreqs rather than those for the whole database for an expanded wildcard, but this seems complex to fix. matcher: * Fix minor wildcard weighting bug spotted while reading the code. We were returning too high a value from the first call to get_maxpart() in some cases. Mostly this just means the matcher continue working when it could have stopped, but it will also cause MSet::get_termweight() to return a higher value than the actual known upper bound. glass backend: * Simplify file descriptor handling for lock files on Unix-like platforms which don't support OFD locks. This eliminates corner cases where we could end up with file descriptors without close-on-exec set in the main process. remote backend: * xapian-tcpsrv: Use _exit() instead of exit() to end child processes which avoids the risk of duplicated output from stdio buffers getting copied by fork() then flushed in both processes. * Simplify file descriptor handling when launching prog remote. inmemory backend: * Fix bug adding posting entries. build system: * Improve probe for -Bsymbolic-functions. MSVC doesn't support this flag, but it only emits a warning when it is used and that warning didn't match any of the patterns we already check for so we were detecting it as supported. * Report result of probe to determine compiler support for -Werror or equivalent. documentation: * Improve MSVC build instructions. Thanks to Baran Demir for feedback. * Improve formatting of stat_flags API documentation. * sorting.rst: Replace custom weighting scheme documentation with a link to the more complete equivalent in "Getting Started with Xapian". * remote.rst: Update to reflect that user metadata is fully supported (since 1.2.4). portability: * Fix to compile as C++20 and C++23. * Resolve SIGPIPE issues on NetBSD, which were causing testcase keepalive1 to fail. These seem to be due to SO_NOSIGPIPE not working correctly there so we now use MSG_NOSIGNAL instead for NetBSD. * Include for sys_errlist. We already do this for the configure check but were failing to when actually using sys_errlist, which probably affects at least NetBSD. * configure: Fix clang detection which wasn't working when configure determined a -std=X option was needed to get C++11 support. The obvious symptom was that --enable-werror wouldn't add -Werror. * configure: NetBSD automatically pulls in library dependencies, so set link_all_deplibs_CXX=no there. * Avoid using sprintf() if snprintf() is available, even in cases where the output size is bounded, to avoid deprecation warnings on macOS. For 1.4.x we still fall back to sprintf() to avoid a point release breaking support for any platform still lacking snprintf(). * Stop linking with --enable-runtime-pseudo-reloc. We were requiring this for cygwin and mingw, but from the documentation it should only be needed for a library which exports data symbols, which we don't do, and the build works without it. * Use `override` for subclassing functors. This is good practice as it gives a clear compile error if we have to change the signature of an virtual method on such a functor. See #830. * Avoid redefining MSVC-specific macros if they are already defined. This avoids an MSVC warning and potential for the code to be ill-formed if the user defines these macros with a value other than 1. Patch from A. Jiang (https://github.com/xapian/xapian/pull/334). Xapian-core 1.4.25 (2024-03-08): API: * MSet::get_eset(): Don't fetch the collection frequency for each term unless we're using the Bo1EWeight expansion scheme which actually needs it. In a simple test this reduced the time taken to do a search and generate expand terms by a third. Partly addresses #264. * QueryParser::parse_query(): Fix parse error when using FLAG_CJK_NGRAM (aka FLAG_NGRAMS) with a query string which has non-CJK followed by whitespace, CJK, and more non-CJK. Patch from Robert Stepanek (https://github.com/xapian/xapian/pulls/331). testsuite: * unittest: Improve sparse file detection by using SEEK_HOLE, which is specified by POSIX and seems to be widely supported. On platforms without it or on an FS with a > 128K block size we will skip the tests involving a 4GB file, but that's acceptable. On ZFS st_blocks reports the number of blocks after compression and also lags behind when data has only been committed to the journal, which means our previous check based on st_blocks couldn't be made to work without potentially falsely detecting sparse file support. Fixes #823, reported by someplaceguy. * apitest: Enable adddoc2 and adddoc5 testcases for sharded databases. We now just skip the TermIterator::get_termfreq() checks in this case. glass backend: * Check Btree level value from disk is in range, which avoids potential out of range access on corrupt database. Fixes #824, reported by group13. * Reject invalid blocksize read from corrupted version file. Throw DatabaseCorruptError if value is out of range or not a power of two. * Optimise allterms iteration. Most terms don't contain any zero bytes, and for such terms the key for the first chunk in the termlist table is just the termname so no decoding is needed when advancing the iterator. This optimisation is 8.4% faster in a simple test of iterating allterms via xapian-delve. * Compaction of an empty non-optional table now gives an empty output, whereas previous it was one block in size (8K by default). This isn't important in general as the non-optional tables are not likely to be empty in a real database, but it's helpful for making small test database and it seems weird that compaction would make a database much larger in percentage terms in this edge case. chert backend: * Check Btree level value from disk is in range, which avoids potential out of range access on corrupt database. Fixes #824, reported by group13. build system: * configure: DragonflyBSD automatically pulls in library dependencies, so set link_all_deplibs_CXX=no there. documentation: * Document allterms_begin() and termlist_begin() iteration order. Thanks to Eric Wong for querying this. * Document TermIterator::get_termfreq() quirk. In the case of a TermIterator from termlist_begin() on a Document from a sharded database, you get term frequencies from just the shard. Fixes #423 portability: * Support building on platforms without AI_NUMERICSERV (e.g. macOS 10.5). Patch from Sergey Fedorov. Xapian-core 1.4.24 (2023-11-06): testsuite: * apitest: Add coverage that docids generated by replace_document() don't wrap to nomoredocids1 testcase. * unittest: Improve block file functions unit test which were (unintentionally) trying to test with a 4TB sparse file, which not all platforms support. A file just over 4GB is enough to test what we want, and if we trying to create one fails with errno EFBIG, indicating the file size is too large, we now skip the rest of the testcase. * unittest: Catch Xapian::Error exceptions and rethrow the std::string returned by get_description() as the utestsuite harness doesn't know about Xapian::Error so was confusingly reporting it as "UNKNOWN EXCEPTION". * The testsuite no longer reports NULL as the address associated with a signal when running on a platform without both sigaction() and SA_SIGINFO. matcher: * Reorder fields in each MSet entry to avoid structure padding on x86-64 probably other 64-bit platforms. This reduces the memory needed to hold an MSet by 8 bytes per entry on such platforms. glass backend: * Eliminate unnecessary memory allocations. When committing changes, we were allocating blocks for all possible levels of the built-in cursor in each writable table, even those levels that weren't in use. The worst case is a really small database with all optional tables existing which would have 54 unused allocations of blocksize + 8 bytes, which with the default 8K block size is ~432KB per WritableDatabase; if you explicitly ask for 64K block size it'll be ~3.4MB. For a more typical WritableDatabase it's probably going to be more like half these numbers. build system: * Add --enable-werror configure option. * configure: Only auto-enable -D_FORTIFY_SOURCE=2 if it works without additional libraries and remove the hard-coded block against using it on mingw. Mingw-w64 v11.0.0 eliminated the requirement to link with -lssp and with this change we now auto-enable -D_FORTIFY_SOURCE=2 for it. portability: * We now avoid triggering SIGPIPE in library code on most platforms. On Unix-like platforms we want to avoid generating SIGPIPE when writing to a socket when the other end has been closed since signals break the encapsulation of what we're doing inside the library - either user code would need to handle the SIGPIPE, or we set a signal handler for SIGPIPE but that would handle *any* SIGPIPE in the process, not just those we might trigger, and that could break user code which expects to trigger and handle SIGPIPE. We don't need SIGPIPE since we can check errno==EPIPE instead (which is actually simpler to do). It seems all current Unix-like platforms now support SO_NOSIGPIPE or MSG_NOSIGNAL, so currently we just fall back to setting SIGPIPE to SIG_IGN. If there are actually current platforms which have SIGPIPE without SO_NOSIGPIPE or MSG_NOSIGNAL then we can look at other ways to avoid generating the signal. * Avoid MSVC warning C4312 which is a reasonable warning in general, but in this case we checked that the value wasn't truncated when cast to an int. * Use TEST_EQUAL_DOUBLE in netstats1 testcase which fixes testcase failure on FreeBSD. * Address GCC13 -Wredundant-move warnings. In 1.4.10 we added std::move() here to address clang warnings from -Wreturn-std-move (enabled by -Wall). Just removing the std::move() reintroduces those warning with clang 8 and clang 11 (but not clang 13 or later) but changing to apply a static_cast to the returned type seems to make all versions of both compilers happy. * Fix build with UCRT64 variant of mingw-w64 by stopping defining __MSVCRT_VERSION__ by default. It looks like doing so hasn't been needed since 2015. * Add workaround for testsuite failures under Wine where attempting to unlink a stub file sometimes fails with errno == EACCES and _doserrno == ERROR_SHARING_VIOLATION. This is what you'd get if the file was still open, but we've already closed it. Sleeping for a second and retrying makes it work, so we now do that. It'd be better to get to the bottom of what's going on, but I've run out of ideas and this workaround is only in the testharness at least. debug code: * xapian-inspect: + `goto` and `until` now go to the entry *after* the specified key if there's no exact match, which seems more natural. + New `count` command. This is actually just the same as `until` which already reports a count of the number of entries advanced by, except that `count` suppresses printing each entry. Xapian-core 1.4.23 (2023-07-07): API: * Add `FLAG_NGRAMS` as a preferred new alias for `FLAG_CJK_NGRAM` and `SNIPPET_NGRAMS` as a preferred new alias for `SNIPPET_CJK_NGRAM`. In the next release series these features have been expanded to cover many more languages so the "CJK" in the name has become inaccurate as it stands for "Chinese, Japanese and Korean"). * Database::check(): Improve the exception message for an empty filename from "Failed to rewind file descriptor -1 (Bad file descriptor)" to "Couldn't find Xapian database or table to check (No such file or directory)". testsuite: * The test harness now supports generated databases for all backends and all testcases which can use generated databases now do, which together improve test coverage as we now run many testcases under more backends. Generated databases can also be cached, which helps speed up the test suite. * Remove some testcases which are now redundant with other testcases or no longer useful for other reasons. * Add regression test for #781, reported by Germán M. Bravo. This bug was fixed 4 years in 1.4.12 but a clean regression test only became possible thanks to changes in this release. * The test harness would attempt to throw a Xapian::Database (rather than Xapian::DatabaseError) if it failed to rename a temporary database to its final name. This would fail because there wasn't a database called "rename failed". Reported by stark3y on #xapian. * apitest: Fix exceed32bitcombineddb1 testcase (which only runs with --enable-64bit-docid). * apitest: Fix nomoredocids1 when configured with --enable-64bit-docid. * Add testcase for removal of positions for replaced doc (regression test for bug in git master not present in 1.4.x). * unittest: Unit test block file functions * Stop using std::endl in tests since this seems to be C++ best practice as it causes a flush of the stream, which is rarely actually wanted. Also often the replacement \n can be combined with a string literal. * Use Xapian::docid for document ids in testcases. Using `int` or `size_t` works, but is less correct and can trigger compiler warnings because not all values are representable. matcher: * BM25PlusWeight: With some parameter combinations we were requesting stats we didn't actually need. Confirmed with Vivek Pal on IRC. glass backend: * Avoid unnecessary copying of data when adding an item to a B-tree table which should speed up indexing a bit. * xapian-check: If the first chunk for a term is a continuation chunk, the affected term was missing from the error message. * xapian-check: We now report the document id as context in many more error messages. chert backend: * Fix wdf upper bounds used when search a modified chert-format WritableDatabase object. A bug introduced in 1.4.19 meant we were using the wdf upper bounds from the last committed version of the database. This bug could cause assertion failures when configured with --enable-assertions. remote backend: * Fix thread-safety issue starting remote prog server. Previously we did some memory allocation in the child process after fork() but before we exec-ed the specified program, but in a multi-threaded program (which libxapian might be used in) it's only safe to call async-signal-safe functions in the child process after fork() until exec, and malloc, etc aren't async-signal-safe. * If we failed to open /dev/null in the child process while starting a remote prog server, we would try to throw an exception. That's not going to work well so now we just call `_exit(-1)`. inmemory backend: * Throw exception on docid overflow like we do in other backends. build system: * configure: When probing for socklen_t or equivalent include the same headers as we do in the code to reduce the risk of configure deciding to use socklen_t but it not getting defined in the code. * configure: When probing if a particular compiler or linker option is supported, we were relying on the compiler exit status but some compilers only warn about unknown options. We now inspect the compiler's stderr output to try to detect such cases. * configure: Avoid compiler warning during GCC version check when compiler needs an option to enable C++11 support. * Avoid running pwd since the directories we need are available in automake variables. documentation: * Suggest protocol buffers for structured document data. Fixes #53. * Clarify documentation for release() methods. * Fix typo "shared database" to "sharded database" in API docs. * Document that transactions aren't atomic across shards. tools: * xapian-progsrv,xapian-tcpsrv: Support multiple DBs with --writable. * xapian-tcpsrv: Fix default timeouts in --help output which have been reported as the name of the constant rather than its value since 1.3.3. * xapian-tcpsrv: When --one-shot is specified, don't do the usual test open of the specified database(s) as it doesn't really seem useful in this case. The test harness uses --one-shot so this reduces overhead when running remote tests. * Stop using std::endl in tools since this seems to be C++ best practice as it causes a flush of the stream, which is rarely actually wanted. Also often the replacement \n can be combined with a string literal. portability: * Don't pass mode to open when it's unused as this triggers "missing O_CREAT or O_TMPFILE?" warnings when compiling for Android. * Stop using INFINITY macro. If the implementation supports floating point infinities then HUGE_VAL gives us infinity as a double directly. If not, then it's the maximum finite value of a double. * Don't auto-enable _FORTIFY_SOURCE on mingw or mingw-w64. Enabling _FORTIFY_SOURCE on newer mingw-w64 requires linking with -lssp so we attempted to stop automatically enabling it there in 1.4.19 but this fix didn't actually work. Trying to get this to work automatically has proved difficult and I couldn't find evidence that _FORTIFY_SOURCE was actually supported on mingw. If it is, enabling manually will still work. * Fix mingw32 build with C++17 compiler, which ends up with std::byte conflicting with byte typedefs in system headers, due to us having `using namespace std;` in some of our internal headers. Switch the ones which are causing problems to more targetted `using std::string;`, etc instead. * Fix WIN32 build with --disable-backend-remote which was failing because we were always trying to build common/socket_utils.cc which fails because SOCKLEN_T hasn't been probed. Fixes #821, reported by mgautier. * soaktest: Use C++11 which is more portable than random(). * In WIN32 builds, pass the program pathname separately to CreateProcess() which is apparently more robust if the program pathname contains spaces. * Stop trying to set Microsoft-specific SO_EXCLUSIVEADDRUSE option on our listening sockets. It's not possible to set both SO_REUSEADDR and SO_EXCLUSIVEADDRUSE so this call will always fail with WSAEINVAL, but we were ignoring these errors because SO_EXCLUSIVEADDRUSE required admin privileges in older OS versions. * Suppress MSVC deprecation warning for GetVersionEx since none of the suggested replacements seems to actually provide the functionality we are using from it. * Fix some warnings from MSVC in the fallback code for overflow-checked arithmetic. * Support Enquire::set_time_limit() on GNU Hurd since Hurd now implements timer_create(). * Remove lingering traces of IRIX support as it's been dead for many years. debug code: * Fix build failure with --enable-assertions due to incorrect variable name in assertion. Patch from Alexei Kharchev in https://github.com/xapian/xapian/pull/327. * Fix GCC warning with --enable-log. * Fix debug logging for 3 GlassDatabase methods to log their parameter. * Add a mechanism to support debug logging templated return types containing commas. This was added to fix a build failure on master with --enable-log reported by ttyS3. Xapian-core 1.4.22 (2023-02-02): testsuite: * Expand canceltransaction1 to test value changes are rolled back. matcher: * Minor optimisations to DPHWeight and TfIdfWeight weighting formulae calculations. * Optimise LatLongDistancePostingSource to avoid pow() call on each document with default k2 setting. glass backend: * Fix bug in recovery from WritableDatabase::commit() failing. If renaming to switch the new version file live fails (e.g. due to the disk being full) we discard the changes, try to write and switch to a different new version file with an increased revision (on failure of this too we close the database), then throw DatabaseError. Unfortunately the roll-back of state is not complete, and if we successfully switch to the different new version file then that bad state persists on disk. In order for this bug to manifest, repeating essentially the same operation which just failed needs to succeed which seems more likely to be a happen when using a filing system which has more sophisticated freespace handling (the reporter was using btrfs), though it's possible with any FS if another process frees up disk space in the small window between the two operations. Thanks to Uwe Kleine-König for reporting and especially for coming up with an easy way to reproduce. build system: * configure: Enable -fno-math-errno if supported. We don't make use of maths function setting errno and if we tell the compiler that it can optimise them better in some cases. documentation: * INSTALL: Document assumptions about platform features * INSTALL: Add section on clang version requirements. Xapian-core 1.4.21 (2022-09-22): glass backend: * Avoid throwing InvalidArgument when searching for overlong terms in some cases. Such terms can't match, but are valid to query for. Patch from Robert Stepanek in https://github.com/xapian/xapian/pull/313. chert backend: * Avoid throwing InvalidArgument when searching for overlong terms in some cases. Such terms can't match, but are valid to query for. build system: * Clean up cygwin and mingw configure checks. When we check $host_os, always anchor at the start (e.g. cygwin* not *cygwin*), and check for msys* as well since that's a derivative of cygwin and behaves similarly for the things we're checking here. * Update to use AX_CXX_COMPILE_STDCXX which is a replacement for AX_CXX_COMPILE_STDCXX_11 (which we were using) which also supports newer C++ standards versions which will be useful. For C++11 the only difference seems to be that the macro now checks for attribute support - we use C++11 attributes so that seems a good thing. documentation: * INSTALL: Restructure MSVC section for clarity. * INSTALL: Mention -D_FORTIFY_SOURCE=3 too (fairly new - requires GCC 12). * Consistently say "macOS" not "Mac OS X", "OS X", etc. * admin_notes.rst: + Update locking section to cover Open File Description locks + Add some discussion of block sizes (fixes #819, reported by mgautier) + Fix cut-and-paste error - we were suggesting that the docdata table only exists if there's positional data. Noted by Gaurav Arora. + Improve markup examples: * Stop using std::endl in examples since this seems to be C++ best practice as it causes a flush of the stream, which is rarely actually wanted. Also often the replacement \n can be combined with a string literal. portability: * Stop trying to check for incompatible C++ ABI between the compiler used to build xapian-core and the compiler used to build code using xapian-core. This check was helpful in the GCC 3 days, but ABI versions 2 and up are compatible aside from obscure corner cases, and GCC now defaults to using the latest ABI version it supports. The result is that this check is no longer useful enough to justify the noise. We still check for incompatible _GLIBCXX_DEBUG between the library and application builds, since that will cause things not to work, and the normal error message doesn't make it clear what's wrong. Reported by David Bremner. * Fix new warnings from GCC 12. * Avoid undefined value use when unpacking a key in a corrupted glass docdata table. We now skip further checks on the entry in this case. * Merge allocations in MSVC directory reading compatibility code so we can allocate in a single malloc() call. * Add accept() wrapper which checks an assumption that Microsoft's SOCKET type only actually holds 32 bit values even in 64 bit platforms and throws an exception if violated. * Eliminate a use of sprintf. * Squash some unhelpful MSVC deprecation warnings. * Declare dummy invalid parameter handler noexcept to fix a warning from MSVC. * Include in configure check for sys_errlist as that's where it is with mingw and MSVC. debug code: * Fix debug logging for Xapian::Internal::intrusive_ptr. GCC 12.2 warned about infinite recursion in the old version, and this seems to be the case. This code has been there a long time, but is only used when debug logging is enabled. It does seem to be used, so presumably nobody's tried to log something which triggered it. Xapian-core 1.4.20 (2022-07-04): API: * Throw DatabaseNotFoundError when the database directory doesn't exist or when it doesn't contain a Xapian database. Patch from Germán Méndez Bravo in https://github.com/xapian/xapian/pull/258 * Improve exception message for attempting to remove an empty term (the exception type is still InvalidArgumentError). Reported by David Bremner. testsuite: * Enable queryparser testcase for OR under NEAR, which has been supported since 1.4.3. * Expand some query-related testcases. matcher: * Optimise when a value range is a superset of the slot bounds but the value slot frequency is not equal to the document count by replacing the lower bound with an empty string to make the bounds check very cheap. * Avoid creating a PostList tree for an empty shard. This avoids pointless work in an uncommon case, but also by handling this up front the code in PostList subclasses for query operators can assume the shard isn't empty which simplifies the code in several places. * Remove lingering handling for database backends without slot bounds since all backends have been required to support these since 1.4.11. * Fix collection frequency estimates for positional operators. This affects the weighting of positional operators in subqueries of OP_SYNONYM with weighting schemes which use the collection frequency. glass backend: * xapian-check: Test decompress data in the spelling and synonym tables. We don't have structure checking for these tables, but we can at least fetch each entry and check for decompression problems. * Improve error if a block is detected as overwritten in WritableDatabase. Drop "are there multiple writers?" as it's rarely a useful question to ask since we started using fcntl() locking as it's now very hard to get multiple concurrent writers on a database. Instead suggest running xapian-check, which is probably the best next step for a user who hits this problem. documentation: * Document precedence of NEAR and ADJ. * INSTALL: Note that MSVS 2022 works. tools: * quest: Add --freqs option to show term frequencies. * xapian-delve -v: Show value slot bounds and freq portability: * Fix to build with a C++20 compiler. * configure now probes for a declaration of strerror_r() before using it, since a declaration is required in C++ code. * MSVC: Use intrinsics to implement addition with overflow check. Xapian-core 1.4.19 (2021-12-31): API: * New QueryParser::FLAG_NO_POSITIONS flag. With this flag enabled, any query operations which would use positional information are replaced by the nearest equivalent which doesn't (so phrase searches, NEAR and ADJ will result in OP_AND). This is intended to replace the automatic conversion of OP_PHRASE, etc to OP_AND when a database has no positional information, which will no longer happen in the release series after 1.4. * Give a compile error for code which adds a Database to WritableDatabase. Prior to 1.4.19, this compiled and effectively created a "black-hole" shard which quietly discarded any changes made to it. In 1.4.19 it's still possible to perform this operation by assigning the WritableDatabase to a Database first, which is harder to fix. This case throws an exception on git master where it's easier to address. Reported by David Bremner on #xapian. * Fix TermIterator::skip_to() with sharded databases which sometimes was failing to advance all the way to the requested term. Uncovered while addressing warning from GCC's -Wduplicated-cond, reported by dcb in #816. * Clamp edit distance to one less than the length of the word we've been asked to correct, which makes the algorithm we use more efficient. We already require suggestion to have at least one character in common, so the only change to suggestions is we'll no longer suggest corrections which are twice as long or longer even if the edit distance would allow it, which seems like an improvement in itself. * Minor optimisation expanding wildcards. * PostingIterator::get_description(): For an all-docs iterator on a glass database, get_description() would call get_docid() which isn't valid to do once the iterator has reached the end. testsuite: * Expand allterms test coverage. matcher: * Fetch wdf upper bound from postlist which avoids an extra postlist table cursor seek per weighted query term, and also means we now use a per-shard wdf upper bound for local shards which will in typically give a tighter weight upper bound which will tend to make various other matcher optimisations more effective. Eric Wong reported this speeds up a particularly slow case from ~2 minutes to ~3 seconds. With this change, OP_ELITE_SET can now select a different subset of terms for each shard regardless of shard type (previously this only happened for remote shards). * Avoid triggering a pointless maximum weight recalculation if an unweighted child of a MultiAndPostList prunes. * Only check if the database has positional information when the query uses positional information. This should help improve notmuch delete performance. Thanks to andreas on #notmuch for analysis of the problem. glass backend: * Optimise Glass::Inverter::has_positions(). Use const auto& instead of just auto for the loop variables. Reported to be faster by andreas on #notmuch. * Cache result of Glass::Inverter::has_positions() since calculating it is potentially very expensive, while maintaining a cached answer is very cheap. remote backend: * Add missing closing parenthesis to reported remote prog context, which has been missing since this code was first added over 20 years ago! Spotted by Gaurav Arora. build system: * Enable compiler option -fno-semantic-interposition if supported. This GCC option allows the compiler to optimise essentially assuming that functions/variables aren't replaced at dynamic link time. Such replacement is not something that it's useful to do for Xapian symbols, and we already turn on -Bsymbolic-functions by default which prevents such replacement anyway by resolving references within the library at build time. Reduces the size of the stripped library on x86-64 Debian unstable by ~1%, and likely makes it faster too. * Avoid bogus deprecation warning when compiling with GCC without optimisation. In this situation, GCC emits a deprecation warning for code in the definition of QueryParser::add_valuerangeprocessor() which is provided for backwards API compatibility even if this method is never used anywhere. This isn't helpful, especially if the user is using -Werror, so disable the -Wdeprecated-deprecations warning for this code. Reported by starmad on #xapian. * Fix GCC -Wmaybe-uninitialized warning. The warning seems bogus as it's about the this pointer being passed to a method which doesn't reference the object, but we can just make the method static to avoid the warning, and that's arguably cleaner for a method called from the object initialiser list. * Automatically enable GCC warnings -Wduplicated-cond and -Wduplicated-branches if using a GCC version new enough to support them. The usefulness of -Wduplicated-cond was highlighted by dcb in #816. * Replace uses of obsolete autoconf macros, fixing warnings if configure is regenerated with a recent release of autoconf. * Simplify configure probe for sigsetjmp and siglongjmp. Just probe individually with AC_CHECK_DECLS and then check that both exist with a preprocessor check. * Update XO_LIB_XAPIAN to fix warning that AC_ERROR is obsolete with modern autoconf. * Support linking against static libxapian with cmake. Patch from Anonymous Maarten in https://github.com/xapian/xapian/pull/317 * Clean up handling of libs we link libxapian with - previously any libraries explicitly specified to configure by the user via LIBS=... as well as -lm (if configure determined it was needed) could get added to XAPIAN_LIBS multiple times, as well as also getting added to the libxapian link command anyway by automake/libtool standard handling. Specifying a library more than once on the link line is not a problem on common platforms, but may be an issue somewhere (and it's on less common platforms where the user is more likely to have to specify LIBS to configure and/or where -lm may be needed). documentation: * configure: Add missing AC_ARG_VAR for all programs so that they are documented in --help output, and so that autoconf knows they are "precious" and preserves them if configure is rerun even when they're specified via an environment variable. * Don't use x^2 to mean x squared in API docs. This is potentially confusing since in C/C++ (and some other languages), ^ means exclusive-or. Write x² instead, which should be clear to all readers. * Improve docs for Xapian::Stopper and SimpleStopper. * docs/intro_ir.rst: Fixed an incorrect term index. Patch from Jaak Ristioja in https://github.com/xapian/xapian/pull/321. * Update for the IRC channel move from freenode to libera.chat. examples: * quest: Don't enable spelling correction by default. It was really only on by default because the spelling correction support in quest was added before --flags. It seems more helpful for the default to match the Xapian::QueryParser API, and also this fixes the weird situation that `--flags default` isn't the default you get without any `--flags` option. * quest: Multiple `--flags` options now get combined - previously only the last was used. portability: * Don't automatically use _FORTIFY_SOURCE on mingw-w64. Recent mingw-w64 versions require -lssp to be linked when _FORTIFY_SOURCE is enabled, so just skip the automatic enabling. Users who want to enable it can specify it explicitly. Fixes #808, reported by xpbxf4. * Workaround NFS issue in test harness function for deleting test databases. On NFS, rmdir() can fail with EEXIST or ENOTEMPTY (POSIX allows either) due to .nfs* files which are used by NFS clients to implement the Unix semantics of a deleted but open file continuing to exist. We now sleep and retry a few times in this situation to give the NFS client a chance to process the closing of the open handle. Problem mentioned in #631. * configure: Drop -lm special case for Sun C++ as this no longer seems to be required. Tested with Sun C++ 5.13, which is the oldest version we now support due to us now requiring C++11. * Use strerrordesc_np() if available. This is a GNU-specific replacement for sys_errlist and sys_nerr. It was added in glibc 2.32 since which sys_errlist and sys_nerr are no longer declared in the headers. * Update debug logging to use std::uncaught_exceptions() under C++17 and later since this allows the debug logging to detect a function without RETURN() annotation which exits normally while there's an uncaught exception (previously the debug logging would think the stack was being unwound through the function). This also avoids deprecation warnings - the old std::uncaught_exception() (note: singular) function was deprecated by C++17 and removed in C++20. * Increase size of buffer passed to strerror_r() from 128 to 1024 bytes, which is the size recommended by the man page on Linux. * Fix -Wdeprecated-copy warning from clang 13. Xapian-core 1.4.18 (2021-01-14): API: * QueryParser::FLAG_ACCUMULATE: New flag. Previously the unstem and stoplist data was always reset by a call to QueryParser::parse_query(), which makes sense if you use the same QueryParser object to parse a series of independent queries. If you're using the same QueryParser object to parse several fields on the same query form, you may want to have the unstem and stoplist data combined for all of them, in which case you can use this flag to prevent this data from being reset. * QueryParser::unstem_begin(): Eliminate unnecessary copying of the data. * Fix typo in Swedish stopword list, syncing change made to Snowball by Daniel Gómez Villanueva. * Remove some French stop words with other meanings, syncing change made to Snowball by PhilippeOuellet. testsuite: * Run testcase testlock4 using backend chert, not just using glass * Skip testcase testlock4 on platforms that don't allow us to implement Database::locked() (which notably include GNU Hurd and Microsoft Windows). documentation: * List DB_NO_TERMLIST in the WritableDatabase constructor API documentation where we already list the other DB_* constants. portability: * Eliminate single use of std::mem_fun() which was deprecated in C++11 and removed in C++17. Reported by Mateusz Pusz in #806. * Add missing includes for std::numeric_limits<>. Reported by stac47 in #805. * Work around mingw.org header issue. MSVC seems to implicitly include but mingw.org's headers don't, leading to ERROR_PIPE_CONNECTED not being defined. Fixes https://github.com/xapian/xapian/pull/318, reported by Alex Sandro. * Suppress MSVC warnings about possible loss of data. The values involved are the number of set bits in a value of integer type, so these warnings are bogus. * Include for size_t and off_t, which is the appropriate header, and needed with Android's bionic libc. Patch from Matthieu Gautier. * Use a temporary file for the Doxygen configuration to work around Doxygen 1.8.19 bug which truncates a config file read from stdin to 4096 bytes (https://github.com/doxygen/doxygen/issues/7975). Xapian-core 1.4.17 (2020-08-21): API: * Database::get_average_length(): Add this as an alias for Database::get_avlen(). In git master we've added this as a preferred new name - adding it to 1.4.x too will make it easier for users to update to using this. * Database::get_spelling_suggestion(): Optimise edit distance initialisation loop to significantly reduce the cost of a typical edit distance calculation. * Fix query expansion on sharded databases. The mechanism for passing in which shard a TermList is from wasn't hooked up and as a result we'd always think it's from the first shard, meaning the statistics would be wrong and that our suggested terms may not have been as good as they should be in this situation. * Enquire::get_eset(): Use string::compare() to avoid 1/3 of the string compares on average. documentation: * Update doxygen HTML headers and footers to resolve issues with some interactive features of the API docs not working. Reported by Enrico Zini. * Stop specifying obsolete doxygen settings PERL_PATH and MSCGEN_PATH. * Clarify API docs for MSet::get_termfreq() to make it clear that this considers all documents in the database, not only those that matched the searched (it would sometimes be useful to be able to report the number of occurrences of a term in the matched documents, but it's not something we currently keep track of). Reported by Tadeusz Sośnierz and Peter Salomonsen. Xapian-core 1.4.16 (2020-06-08): API: * MSet::snippet(): The snippet now includes trailing punctuation which carries meaning or gives useful context. See https://github.com/xapian/xapian/pull/180, reported by Robert Stepanek. * MSet::snippet(): Fix segfault generating snippet from default-constructed MSet. This probably isn't something you'd typically do, but it shouldn't crash. Found during extended testing of #803 (which only affected git master) which was reported by Robert Stepanek. * Remove trailing full stop from exception messages. We conventionally don't include one, but a few cases didn't follow that convention. testsuite: * Replace direct use of ftime() which gives deprecation warnings with recent mingw. Reported by srinivasyadav22. matcher: * Fix segfault in rare cases in the query optimiser. We keep a pointer to the most recent posting list to use as a hint for opening the next posting list, but the existing mechanism to take ownership of this hint had a flaw. We now invalidate the hint in situations where it might be indirectly deleted which is safe, but somewhat conservative. * Improve the optimisation of an always-matching OP_VALUE_GE to also take effect when the value slot's lower bound is equal to the limit of the OP_VALUE_GE. Patch from boda sadalla. glass backend: * Report the correct errno value if commit() fails. We were potentially reporting ENOENT from an unlink() call cleaning up a temporary file prior to throwing the exception instead. documentation: * Fix missing menus in API documentation. Newer doxygen generates .js files which we also need to distribute and install. Reported by sec^nd on #xapian. * Note OP_FILTER ignored subquery bug fixed in 1.4.15 as present in 1.4.14 and older. portability: * Use our own autoconf cache variable namespace (xo_cv_ prefix instead of ac_cv_) to avoid colliding with standard autoconf macro use if config.site or a shared config.cache is used. The former case caused a build failure for the OpenBSD port with 1.4.15, reported by Lucas R. * Use clock_gettime() and nanosleep() under modern mingw as these allow higher precision than what we previously used. Xapian-core 1.4.15 (2020-02-24): API: * Database::check(): Fix checking of replication changesets. This reverts a change incorrectly made in 1.3.7. * Database::locked(): Return false instead of true for a closed inmemory DB. * Database::commit(): If commit() failed with an exception while trying to add pending changes (e.g. InvalidArgumentError due to a long term containing zero bytes) then a subsequent commit() on the same object would throw the same exception. Now we clear the pending changes in this situation (like we already did for failure at other stages in the commit). This bug remains unfixed for the chert backend as it's harder to fix there and the effort to fix it and extra risk of breakage don't seem justified for a backend we recommend people migrate away from. * QueryParser::parse_query(): Optimise parsing of multi-word synonyms. testsuite: * Use 50-word synonym for qp_scale1 "large" case. 50 divides exactly into the number of repetitions we do for the "small" case, which 60 (as used before) doesn't. This makes the two cases a little more comparable and should help make this testcase less flaky (see #764). * Adjust testcase matches1 to work with remote shards where the matcher can return slightly better bounds on the number of matches in some cases. Resolves 2 XFAILs. * The testharness get_remote_database() method is now supported for sharded databases. This is needed for keepalive1 to run successfully under multi test backends. Resolves 2 XFAILs of keepalive1. * Improved test coverage: + Test locked() on a closed WritableDatabase, which already returns false (as expected) in 1.4.x (but was broken on master). + Check multi databases in testsuite - this has been supported by Database::check() since 1.4.12. + Also test OP_SYNONYM and OP_MAX in emptydb1. + Backport testcases boolorbug1, emptynot1, emptymaybe1 and phraseweightcheckbug1 from git master - these are regression tests for fixed bugs which only affected git master, but it's useful to confirm that these bugs don't currently affect 1.4, and ensure they don't get introduced. * perftest: Store memory sizes as long long since on Microsoft Windows long is only 32 bits, which is less than common memory sizes. matcher: * Hoist positional check above OP_FILTER. * Handle OP_FILTER with more than two subqueries correctly. Previously we'd only check the first two subqueries in some situations. remote backend: * For a remote WritableDatabase, the client now keeps track of whether there are pending changes, and if there aren't then we now do nothing for commit() or cancel() calls. In particular this saves a message exchange when the WritableDatabase destructor is called when changes have already been committed with an explicit call to commit() (which is what we recommend doing, since with an explicit call to commit() you get to see any exception which gets thrown). * When closing a remote prog WritableDatabase, previously an exception could leave the remote connection open with the remote server running, and we'd then wait for the specified timeout before closing the connection. Now we close the connection before letting the exception propagate. * Don't swallow exceptions from Database::close() on a remote database. If we aren't in a transaction and so try to commit() and that fails then previously the caller would have no indication of the failure. * Fix handling the reported term weight when remote shards are searched. Fixes 5 XFAILs in the testsuite. * Add missing space to mismatching protocol versions error message. build system: * Fix to build when configured with --disable-backend-remote, broken by changes in 1.4.14. Fixes #797, reported by Дилян Палаузов. * The clang and icc compilers both define __GNUC__, which led our ABI mismatch message to report them as "g++" with a bogus version (the version of GCC that these compilers advertise themselves as, which for clang is always 4.2.0) - now we report clang++ or icc along with the actual version of that compiler. documentation: * AUTHORS: Apply missed update to the thankyou list for 1.4.14. * INSTALL: Note that MSVC 2019 works. * INSTALL: Note that Xapian can use the system uuid.h on AIX and OpenBSD. portability: * Simplify probes for snprintf. The broken snprintf in libbsd in Linux libc4 is from ~25 years ago so way too ancient to matter now, and all callers already handle the pre-ISO semantics of returning -1 for an undersize buffer so we don't need to run a test program to probe for this at configure time, which is more cross-compile friendly. * Don't quote messages in #error - the quotes aren't required and appear in the compiler output (at least with GCC and clang) making it less readable. * Use a different approach for getting a 64-bit capable stat() for mingw32. This means we now use the same stat variant for mingw32 and MSVC, which seems a better plan. * Work around unhelpful config.status behaviour. It comments out any #undef lines in config.h, even those added via AH_TOP and AH_BOTTOM. Splitting these lines means they don't match the regex hammer config.status uses. * Avoid -Wdeprecated-copy warnings from clang 10. * Avoid deprecation warning on recent Linux. We were including sys/sysctl.h if it existed, which it does on Linux but we don't actually use it there. Including it now warns that it is deprecated, so skip including it under Linux. Reported on IRC by kumaran. * Suppress GCC -Wduplicated-branches warning from our API headers in a different way which avoids needing a compiler-specific #pragma. * Workaround closefrom1 failure on macOS. It seems under macOS our fd tracking can end up using fd 10 so start from 13 when testing closefrom() so we don't close the fd which our fd tracking is using internally. debug code: * Log RemoteConnection::read_at_least() return value. Xapian-core 1.4.14 (2019-11-23): API: * Xapian::QueryParser: Handle "" inside a quoted phrase better. In a quoted boolean term, "" is treated as an escaped ", so handle it in a compatible way for quoted phrases. Previously we'd drop out of the phrase and start a new phrase. Fixes #630, reported by Austin Clements. * Xapian::Stem: The constructor which takes a stemmer name now takes an optional second bool parameter - if this is true, then an unknown stemmer name falls back to using the "none" stemmer instead of throwing an exception. This allows simply constructing a stemmer from an ISO language code without having to worry about whether there's a stemmer for that language, and without having to handle an exception if there isn't. * Xapian::Stem: Fix a bug with handling 4-byte UTF-8 sequences which potentially affects most of the stemmers. None of the stemmers work in languages where 4-byte UTF-8 sequences are part of the alphabet, but this bug could result in invalid UTF-8 sequences in terms generated from text containing high Unicode codepoints such as emoji, which can cause issues (for example, in some language bindings). Fix synced from Snowball git post 2.0.0. Reported by Ilari Nieminen in https://github.com/snowballstem/snowball/issues/89. * Xapian::Stem: Add a new is_none() method which tests if this is a "none" stemmer. * Xapian::Weight: The total length of all documents is now made available to Xapian::Weight subclasses, and this is now used by DLHWeight, DPHWeight and LMWeight. To maintain ABI compatibility, internally this still fetches the average length and the number of documents, multiplies them, then rounds the result, but in the next release series this will be handled directly. * Xapian::Database::locked() on an inmemory database used to always return false, but an inmemory Database is always actually a WritableDatabase underneath, so now we always report true in this case because it's really always report being locked for writing. testsuite: * Fix failing multi_glass_remoteprog_glass tests on x86. When the tests are run under valgrind, remote servers should be run using the runsrv wrapper script, but this wasn't happening for remote servers in multi-databases - now it is. Also, previously runsrv only used valgrind for the remote for an x86 build that didn't use SSE, but it seems there are x87 instructions in libc that are affected by valgrind not providing excess precision, so do this for x86 builds which use SSE too. Together these changes fix failures of topercent2, xor2, tradweight1 under backend multi_glass_remoteprog_glass on x86. * Fix C++ One-Definition Rule (ODR) violation in testsuite code. Two different source files linked into apitest were each defining a different `struct test`. Wrap each in an anonymous namespace to localise it to the file it is defined and used in. This was probably harmless in practice, unless trying to build with Link-Time Optimisation or similar (which is how it was detected). * Test all language codes in stemlangs1. The testsuite hardcodes a list of supported language codes which hadn't been updated since 2008. * Improve DateRangeProcessor test coverage. matcher: * Handle pruning under a positional check. This used to be impossible, but since 1.4.13 it can happen as we now hoist AND_NOT to just below where we hoist the positional checks. The code on master already handles pruning here so this bug is specific to the RELEASE/1.4 branch. Fixes #796, reported by Oliver Runge. * When searching with collapsing over multiple shards, at least some of which are remote, uncollapsed_upper_bound could be too low and uncollapsed_lower_bound too high. This was causing assertion failures in testcases msize1 and msize2 under test harness backends multi_glass_remoteprog_glass and multi_remoteprog_glass. * Internally we no longer calculate a bogus total_term_count as the sum of total_length * doc_count for all shards. Instead we just use the sum of total_length, which gives the total number of term occurrences. This change should improve the estimated collection_freq values for synonyms. * Several places where we might divide zero by zero in a database where wdf was always zero have been fixed. build system: * configure: Stop using AC_FUNC_MEMCMP. The autoconf manual marks it as "obsolescent", and it seems clear that nobody's relying on it as we're missing the "'AC_LIBOBJ' replacement for 'memcmp'" which it would try to use if needed. documentation: * HACKING: Replace release docs with pointer to the developer guide where they are now maintained. portability: * Eliminate 2 uses of atoi(). These are potentially problematic in a multithreaded application if setlocale() is called by another thread at the same time. See #665. * Don't check __GNUC__ in visibility.h as the configure probe before defining XAPIAN_ENABLE_VISIBILITY checks that the visibility attributes work. This probably makes no difference in practice, as all compilers we're aware of which support symbol visibility also define __GNUC__. * Document Sun C++ requires --disable-shared. Closes #631. Xapian-core 1.4.13 (2019-10-14): API: * Fix write one past end of std::vector on certain QueryParser parser errors. This is undefined behaviour, but the write was always into reserved space, so in practice we'd actually get away with it (it was noticed because it triggers an error when running under ubsan and using libc++). Reported by Germán M. Bravo. * MSet::get_matches_estimated(): Improve rounding of result - a bug meant we would almost always round down. * Optimise test for UTF-8 continuation character. Performing a signed char comparison shaves an instruction or two on most architectures. * Database::get_revision(): Return revision 0 for a Database with no shards rather that throwing InvalidOperationError. * DPHWeight: Avoid dividing by 0 when searching a sharded database when one shard is empty. The result wasn't used in this case, but it's still undefined behaviour. Detected by UBSan. testsuite: * The "singlefile" test harness backend manager now creates databases by compacting the corresponding underlying backend database (creating it first if need be) rather than always creating a temporary database to compact. * Enable compaction testcases for multi and singlefile test harness backends. * Add generated database support for remoteprog and remotetcp test harness backends. Implemented by Tanmay Sachan. * Add test harness support for running testcases using a multi database comprised of one local and one remote shard, or two remote shards. Implemented by Tanmay Sachan. * Check if removing existing multi stub failed. Previously if removing an existing stub failed, the test harness would create a temporary new stub and then try to rename it over the old one, which will always fail on Microsoft Windows. * Wait for xapian-tcpsrv processes to finish before moving on to the next testcase under __WIN32__ like we already do on POSIX platforms. matcher: * Optimise OP_AND_NOT better. We now combine its left argument with other connected and-like subqueries, and gather up and hoist the negated subqueries and apply them together above the combined and-like subqueries, just below any positional filters. * Optimise OP_AND_MAYBE better. We now combine its left argument with other connected and-like subqueries, and gather up and hoist the optional subqueries and apply them together above the combined and-like subqueries and any hoisted positional filters. * Treat all BoolWeight queries as scaled by 0 - we can optimise better if we know the query is unweighted. glass backend: * Allow zlib compression to reduce size by one byte. We were specifying an output buffer size one byte smaller than the input, but it appears zlib won't use the final byte in the buffer, so we actually need to pass the input size as the output buffer size. * Only try to compress Btree item values > 18 bytes, which saves CPU time without sacrificing any significant size savings. remote backend: * Fix match stats when searching with collapsing over multiple shards and at least some shards are remote. Bug discovered by Tanmay Sachan's test harness improvements. * Ignore orphaned remote protocol replies which can happen when searching with a remote shard if an exception is thrown by another shard. Bug discovered by Tanmay Sachan's test harness improvements. * Wait for xapian-progsrv child to exit when a remote Database or WritableDatabase object is closed under __WIN32__ like we already do for POSIX platforms. documentation: * Correct documentation of initial messages in replication protocol. tools: * quest: Report bounds and estimate of number of matches. * xapian-delve: Improve output when database revision information is not available. We now specially handle the cases of a DB with multiple shards and a backend which doesn't support get_revision(). portability: * Fix warning from GCC 9 with -Wdeprecated-copy (which is enabled by -Wextra) if a reference to an Error object is thrown. * Suppress GCC warning in our API headers when compiling code using Xapian with GCC and -Wduplicated-branches. * Mark some internal classes as final (following GCC -Wsuggest-final-types suggestions to allow some method calls to be devirtualised). * Fix to build with --enable-maintainer-mode and Perl < 5.10, which doesn't have the `//=` operator. It's unlikely developers will have such an old Perl, but the mingw environment on appveyor CI does. The use of `//=` was introduced by changes in 1.4.10. Xapian-core 1.4.12 (2019-07-23): API: * Xapian::PostingSource: When a PostingSource without a clone() method is used with a Database containing multiple shards, the documented behaviour has always been that Xapian::InvalidOperationError is thrown. However, since at least 1.4.0, this exception hasn't been thrown, but instead a single PostingSource object would get used for all the shards, typically leading to incorrect results. The actual behaviour now matches what was documented. * Xapian::Database: Add size() method which reports the number of shards. * Xapian::Database::check(): You can now pass a stub database which will check all the databases listed in it (or throw Xapian::UnimplementedError for backends which don't support checking). * Xapian::Document: When updating a document use a emplace_hint() to make the bulk insertion O(n) instead of O(n·log(n)), and use std::move() to avoid copying OmDocumentTerm objects. * Xapian::Query: Add missing get_unique_terms_end() method. * Xapian::iterator_valid(): Implement for Utf8Iterator testsuite: * Fix keepalive1 failures on some platforms. On some platforms a timeout gives NetworkTimeoutError and on others NetworkError - since 1.4.10 changed to checking the exact exception type, keepalive1 has been failing on the former set of platforms. We now just check for NetworkError or a subclass here (since NetworkTimeoutError is a subclass of NetworkError). * Run cursordelbug1 testcase with multi databases too. matcher: * Ownership of PostingSource objects during the match now makes use of the optional reference-counting mechanism rather than a separate flag. remote backend: * Fix remote protocol design bug. Previously some messages didn't send a reply but could result in an exception being sent over the link. That exception would then get read as a response to the next message instead of its actual response so we'd be out of step. Fixes #783, reported by Germán M. Bravo. This fix necessitated a minor version bump in the remote protocol (to 39.1). If you are upgrading a live system which uses the remote backend, upgrade the servers before the clients. * Fix socket leaks on errors during opening a database. Fixes https://github.com/xapian/xapian/pull/237 and #781, reported by Germán M. Bravo. * Don't close remote DB socket on receiving EOF as the levels above won't know it's been closed and may try to perform operations on it, which would be problematic if that fd gets reused in the meantime. Leaving it open means any further operations will also get EOF. Reported by Germán M. Bravo. * We add a wrapper around the libc socket() function which deals with the corner case where SOCK_CLOEXEC is defined but socket() fails if it is specified (which can happen with a newer libc and older kernel). Unfortunately, this wrapper wasn't checking the returned value from socket() correctly, so when SOCK_CLOEXEC was specified and non-zero it would create the socket() with SOCK_CLOEXEC, then leak that one and create it again without SOCK_CLOEXEC. We now check the return value properly. * Fix potential infinite loop in ValueCountMatchSpy::merge_results() if passed serialised results with extra data appended (which shouldn't happen in normal use). build system: * Current versions of valgrind result in false positives on current versions of macOS, so on this platform configure now only enables use of valgrind if it's specified explicitly. Fixes #713, reported by Germán M. Bravo. * Refactor macros to probe for compiler flags so they automatically cache their results and consistently report success/failure. * Rename our custom TYPE_SOCKLEN_T macro to XAPIAN_TYPE_SOCKLEN_T. The AX_TYPE_SOCKLEN_T macro defines an alias of TYPE_SOCKLEN_T for itself which means it can get used instead in some situations, but it isn't compatible with our macro. We can't just switch to AX_TYPE_SOCKLEN_T as it doesn't handle cases we need, so just rename our macro to avoid potential problems. documentation: * Improve API documentation for Xapian::Query class. Add missing doc comments and improve some of the existing ones. Problems highlighted by Дилян Палаузов in #790. * Add Unicode consortium names and codes for categories from Chapter 4, Version 11 of the Unicode standard. Patch from David Bremner. * Improve configure --help output - drop "[default=no]" for --enable-* options which default off. Fixes #791, reported by and patch from Дилян Палаузов. * Fix API documentation typo - Query::op (the type) not op_ (a parameter name). * Note which version Document::remove_postings() was added in. * In the remote protocol documentation, MSG_REPLACEDOCUMENTTERM was documented as not having a reply, but actually REPLY_ADDDOCUMENT is sent. * Update list of users. tools: * copydatabase: A change in 1.4.6 which added support for \ as directory separator on platforms where that's the norm broke the code in copydatabase which removes a trailing slash from input databases. Bug reported and culprit commit identified by Eric Wong. portability: * Resolve crash on Windows when using clang-cl and MSVC. Reported by Christian Mollekopf in https://github.com/xapian/xapian/pull/256. * Add missing '#include '. Patch from Tanmay Sachan. * Fix str() helper function when converting the most negative value of a signed integer type. * Avoid calling close() on fd we know must actually be a WIN32 SOCKET. * Include not for std::boolalpha. * Rework setenv() compatibility handling. Now that Solaris 9 is dead we can assume setenv() is provided by Unix-like platforms (POSIX requires it). For other platforms, provide a compatibility implementation of setenv() which so the compatibility code is encapsulated in one place rather than replicated at every use. * Fix maintainer-mode builds on Solaris where /bin/tr is not POSIX compliant. We now use the simple workaround suggested by the autoconf manual. * Improve support for Sun C++ (see #631): + Suppress unhelpful warning for lambda with multiple return statements. + Enable reporting the tags corresponding to warnings, which we need to know in order to suppress any new unhelpful warnings. + Adjust our workaround for bug with this compiler's header to avoid a compiler warning. + Use -xldscope=symbolic for Sun C++. This flag is roughly equivalent to -Bsymbolic-functions which we've probed for with GNU ld since Xapian 1.0.0. Xapian-core 1.4.11 (2019-03-02): API: * MSet::SNIPPET_CJK_NGRAM - new flag for use with MSet::snippet() to enable support for selecting and highlighting snippets which works with the QueryParser and TermGenerator FLAG_CJK_NGRAM flags. This mode can also be enabled by setting environment variable XAPIAN_CJK_NGRAM to a non-empty value. (There was nominally already support for XAPIAN_CJK_NGRAM in MSet::snippet(), but it didn't work usefully - the highlighting added was all empty start/end pairs at the end of the span of CJK characters containing the CJK ngram terms, which to the user would typically look like it was selecting the end of the text and not highlighting anything). * Deprecate XAPIAN_CJK_NGRAM environment variable. There are now flags which can be used instead in all cases, and there's sadly no portable thread-safe way to read an environment variable so checking environment variables is problematic in library code that may be used in multithreaded programs. * Query::OP_ELITE_SET currently incorrectly recursively flattens any OP_OR (or OP_OR-like) subqueries into the list of subqueries it selects from - until that's fixed, we now select from the full exploded list rather than the last n (where n is the number of direct subqueries of the OP_ELITE_SET). testsuite: * Testcases which need a generated database now get run with a sharded database. * Avoid using strerror() in the testsuite which removes an obstacle to running tests in parallel in separate threads. matcher: * Extend detection of cases of OP_SYNONYM with disjoint subqueries (which means we don't need document length) which was added in 1.4.8 - we now detect when all subqueries are different terms, or when all subqueries are non-overlapping wildcards. The second case is what QueryParser produces for a wildcard or partial query with a query prefix which maps to more than one term prefix. glass backend: * Handle an empty value slot lower bound gracefully. This shouldn't happen for a non-empty slot, but has been reported by a notmuch user so it seems there is (or perhaps was as the database was several years old) a way it can come about. We now check for this situation and set the smallest possible valid lower bound instead, so other code assuming a valid lower bound will work correctly. Reported by jb55. chert backend: * Handle an empty value slot lower bound gracefully, equivalent to the change made for glass. documentation: * HACKING: We no longer use auto_ptr<>. * NEWS: Correct factual error in old entry - the 0.4.1 release was Open Muscat not OmSee (the OmSee name was only applied after that final release was made, and only used internally to BrightStation). portability: * Suppress more clang -Wself-assign-overloaded warnings in testcases which are deliberately testing handling of self-assignment. * Add missing includes of . Fixes #776, reported by Matthieu Gautier. debug code: * When configured with --enable-log, the O_SYNC flag was always specified when opening the logfile, with the intention that the most recent log entries wouldn't get lost if there was a crash, but O_SYNC can incur a significant performance overhead and most debugging is not of such crashes. So we no longer specify O_SYNC by default, but you can now request synchronous logging by including %! anywhere in the filename specified with XAPIAN_DEBUG_LOG (the %! is replaced with the empty string). We also now use O_DSYNC if available in preference to O_SYNC, since the mtime of the log file isn't important. Xapian-core 1.4.10 (2019-02-12): API: * DatabaseClosedError: New exception class thrown instead of DatabaseError when an operation is attempted which can't be completed because it involves a database which close() was previously called on. DatabaseClosedError is a subclass of DatabaseError so existing code catching DatabaseError will still work as before. Fixes #772, reported by Germán M. Bravo. Patch from Vaibhav Kansagara. * DatabaseNotFoundError: New exception class thrown instead of DatabaseOpeningError when the problem is the problem is "file not found" or similar. DatabaseNotFoundError is a subclass of DatabaseOpeningError so existing code catching DatabaseOpeningError will still work as before. Fixes #773, reported by Germán M. Bravo. Patch from Vaibhav Kansagara. * Query: Make &=, |= and ^= on Query objects opportunistically append to an existing query with a matching query operator which has a reference count of 1. This provides an easy way to incrementally build flatter query trees. * Query: Support `query &= ~query2` better - this now is handled exactly equivalent to `query = query & ~query2` and gives `query AND_NOT query2` instead of `query AND ( AND_NOT query2)`. * QueryParser: Now uses &=, |= and ^= to produce flatter query trees. This fixes problems with running out of stack space when handling Query object trees built by abusing QueryParser to parse very large machine-generated queries. * Stopper: Fix incorrect accents in Hungarian stopword list. Patch from David Corbett. testsuite: * Test MSet::snippet() with small and zero lengths. Fixes #759. Patch from Vaibhav Kansagara. * Fix testcase stubdb4 annotations - this testcase doesn't need a backend. * Add PATH annotation for testcases needing get_database_path() to avoid having to repeatedly list the backends where this is supported in testcase annotations. * TEST_EXCEPTION helper macro now checks that the exact specified exception type is thrown. Previously it would allow a subclass of the specified exception type, but in testcases we really want to be able to test for an exact type. Issue noted by Vaibhav Kansagara on IRC. matcher: * Map OP_VALUE_GE/OP_VALUE_LE on an empty slot to EmptyPostList. We already do this for OP_VALUE_RANGE, and it's a little more efficient than creating a postlist object which checks the empty value slot. glass backend: * We no longer flush all pending positional changes when a postlist, termlist or all-terms is opened on a modified WritableDatabase. Doing so was incurring a significant performance cost, and the first of these happens internally when `replace_document(term, doc)` is used, which is the usual way to support non-numeric unique ids. We now only flush pending positional changes when committing. Reported and diagnosed by Germán M. Bravo. remote backend: * Use poll() where available instead of select(). poll() is specified by POSIX.1-2001 so should be widely available by now, and it allows watching any fd (select() is limited to watching fds < FD_SETSIZE). For any platforms which still lack poll() we now workaround this select() limitation when a high numbered fd needs to be watched (for example, by trying a non-blocking read or write and on EAGAIN sleeping for a bit before retrying). * Stop watching fds for "exceptional conditions" - none of these are relevant to our usage. * Remove 0.1s timeout in ready_to_read(). The comment says this is to avoid a busy loop, but that's out of date - the matcher first checks which remotes are ready to read and then does a second pass to handle those which weren't with a blocking read. build system: * Stop probing for header sys/errno.h which is no longer used - it was only needed for Compaq C++, support for which was dropped in 1.4.8. documentation: * docs/valueranges.html: Update to document RangeProcessor instead of ValueRangeProcessor - the latter is deprecated and will be gone in the next release series. * Document RangeProcessor::operator()() returns OP_INVALID to signal it doesn't recognise a range. * Update some URLs for pages which have moved. * Use https for URLs where available. * HACKING: Update "empty()" section for changes in C++11. portability: * Suppress clang warnings for self-assignment tests. Some testcases trigger this new-ish clang warning while testing that self-assignment works, which seems a useful thing to be testing - at least one of these is a regression test. * Add std::move to fix clang -Wreturn-std-move warning (which is enabled by -Wall). * Add casts to fix ubsan warnings. These cases aren't undefined behaviour, but are reported by ubsan extra checks implicit-integer-truncation and/or implicit-conversion which it is useful to be able to enable to catch potential bugs. * Fix check for when to use _byteswap_ulong() - in practice this would only have caused a problem if a platform provided _byteswap_ushort() but not _byteswap_ulong(), but we're not aware of any which do. * Fix return values of do_bswap() helpers to match parameter types (previously we always returned int and only supported swapping types up to 32 bits, so this probably doesn't result in any behavioural changes). * Only include if we'll use it instead of always including it when it exists. Including can result in warnings about duplicate declarations of builtin functions under mingw. * Remove call to close()/closesocket() when the argument is always -1 (since the change to use getaddrinfo() in 1.3.3). Xapian-core 1.4.9 (2018-11-02): API: * Document::add_posting(): Fix bugs with the change in 1.4.8 to more efficiently handle insertion of a batch of extra positions in ascending order. These could lead to missing positions and corrupted encoded positional data. remote backend: * Avoid hang if remote connection shutdown fails by not waiting for the connection to close in this situation. Seems to fix occasional hangs seen on macOS. Patch from Germán M. Bravo. Xapian-core 1.4.8 (2018-10-25): API: * QueryParser,TermGenerator: Add new stemming mode STEM_SOME_FULL_POS. This stores positional information for both stemmed and unstemmed terms, allowing NEAR and ADJ to work with stemmed terms. The extra positional information is likely to take up a significant amount of extra disk space so the default STEM_SOME is likely to be a better choice for most users. * Database::check(): Fetch and decompress the document data to catch problems with the splitting of large data into multiple entries, corruption of the compressed data, etc. Also check that empty document data isn't explicitly stored for glass. * Fix an incorrect type being used for term positions in the TermGenerator API. These were Xapian::termcount but should be Xapian::termpos. Both are typedefs for the same 32-bit unsigned integer type by default (almost always "unsigned int") so this change is entirely compatible, except that if you were configuring 1.4.7 or earlier with --enable-64bit-termcount you need to also use the new --enable-64bit-termpos configure option with 1.4.8 and up or rebuild your applications. This change was necessary to make --enable-64bit-termpos actually useful. * Add Document::remove_postings() method which removes all postings in a specified term position range much more efficiently than by calling remove_posting() repeatedly. It returns the number of postings removed. * Fix bugs with handling term positions >= 0x80000000. Reported by Gaurav Arora. * Document::add_posting(): More efficiently handle insertion of a batch of extra positions in ascending order. * Query: Simplify OP_SYNONYM with single OP_WILDCARD subquery by converting to OP_WILDCARD with combiner OP_SYNONYM, which means such cases can take advantage of the new matcher optimisation in this release to avoid needing document length for OP_WILDCARD with combiner OP_SYNONYM. testsuite: * Catch and report std::exception from the test harness itself. * apitest: Drop special case for not storing doc length in testcase postlist5 - all backends have stored document lengths for a long time. * test_harness: Create directories in a race-free way. matcher: * Avoid needing document length for an OP_WILDCARD with combiner OP_SYNONYM. We know that we can't get any duplicate terms in the expansion of a wildcard so the sum of the wdf from them can't possibly exceed the document length. * OP_SYNONYM: No longer tries to initialise weights for its subquery, which should reduce the time taken to set up a large wildcard query. * OP_SYNONYM: Fix frequency estimates when OP_SYNONYM is used with a subquery containing OP_XOR or OP_MAX - in such cases the frequency estimates for the first subquery of the OP_XOR/OP_MAX were used for all its subqueries. Also the estimated collection frequency is now rounded to the nearest integer rather than always being rounded down. glass backend: * Revert change made in 1.4.6: Enable glass's "open_nearby_postlist" optimisation (which especially helps large wildcard queries) for writable databases without any uncommitted changes as well. The amended check isn't conservative enough as there may be postlist changes in the inverter while the table is unmodified. This breaks testcase T150-tagging.sh in notmuch's testsuite, reported by David Bremner. * When indexing a document without any terms we now avoid some unnecessary work when storing its termlist. build system: * New --enable-64bit-termpos configure option which makes Xapian::termpos a 64-bit type and enables support for storing 64-bit termpos values in the glass backend in an upwardly compatible way. Few people will actually want to index documents more than 4 billion words long, but the extra numbering space can be helpful if you want to use term positions in "interesting" ways. * Hook up configure --disable-sse/--enable-sse=sse options for MSVC. * Fix configure probes for builtin functions for clang. We need to specify the argument types for each builtin since otherwise AC_CHECK_DECLS tries to compile code which just tries to take a pointer to the builtin function causing clang to give an error saying that's not allowed. If the argument types are specified then AC_CHECK_DECLS tries to compile a call to the builtin function instead. documentation: * Fix documentation comment typo. tools: * xapian-delve: Test for all docs empty using get_total_length() which is slightly simpler internally than get_avlength(), and avoids an exact floating point equality check. examples: * quest: Support --weight=coord. * xapian-pos: New tool to show term position info to help debugging when using positional information in more complex ways. portability: * Fix undefined behaviour from C++ ODR violation due to using the same name two different non-static inline functions. It seems that with current GCC versions the desired function always ends up being used, but with current clang the other function is sometimes used, resulting in database corruption when using value slots in docid 16384 or higher with the default glass backend. Patch from Germán M. Bravo. * Suppress alignment cast warning on sparc Linux. The pointer being cast is to a record returned by getdirentries(), so it should be suitable aligned. * Drop special handling for Compaq C++. We never actually achieved a working build using it, and I can find no evidence that this compiler still exists, let alone that it was updated for C++11 which we now require. * Create new database directories in race-free way. * Avoid throwing and handling an exception in replace_document() when adding a document with a specified docid which is <= last_docid but currently unused. * Use our portable code for handling UUIDs on all platforms, and only use platform-specific code for generating a new UUID. This fixes a bug with converting UUIDs to and from string representation on FreeBSD, NetBSD and OpenBSD on little-endian platforms which resulted in reversed byte order in the first three components, so the same database would report a different UUID on these platforms compared to other platforms. With this fix, the UUIDs of existing databases will appear to change on these platforms (except in rare "palindronic" cases). Reported by Germán M. Bravo. * Fix to build with a C++17 compiler. Previously we used a "byte" type internally which clashed with "std::byte" in source files which use "using namespace std;". Fixes #768, reported by Laurent Stacul. * Adjust apitest testcase stubdb2 to allow for NetBSD oddity: NetBSD's getaddrinfo() in IPv4 mode seems to resolve ::1 to an IPv4 address on the local network. * Avoid timer_create() on OpenBSD and NetBSD. On OpenBSD it always fails with ENOSYS (and there's no prototype in the libc headers), while on NetBSD it seems to work, but the timer never seems to fire, so it's useless to us (see #770). * Use SOCK_NONBLOCK if available to avoid a call to fcntl(). It's supported by at least Linux, FreeBSD, NetBSD and OpenBSD. * Use O_NOINHERIT for O_CLOEXEC on Windows. This flag has essentially the same effect, and it's common in other codebases to do this. * On AIX O_CLOEXEC may be a 64-bit constant which won't fit in an int. To workaround this stupidity we now call the non-standard open64x() instead of open() when the flags don't fit in an int. * Add functions to add/multiply with overflow check. These are implemented with compiler builtins or equivalent where possible, so the overflow check will typically just require a check of the processor's overflow or carry flag. Xapian-core 1.4.7 (2018-07-19): API: * Database::check(): Fix bogus error reports for documents with length zero due to a new check added in 1.4.6 that the doclength was between the stored upper and lower bounds, which failed to allow for the lower bound ignoring documents with length zero (since documents indexed only by boolean terms aren't involved in weighted searches). Reported by David Bremner. * Query: Use of Query::MatchAll in multithreaded code causes problems because the reference counting gets messed up by concurrent updates. Document that Query(string()) should be used instead of MatchAll in multithreaded code, and avoid using it in library code. Reported by Germán M. Bravo. * Stem: + Stemming algorithms added for Irish, Lithuanian, Nepali and Tamil. + Merge Snowball compiler changes which improve code generation. + Merge optimisations to the Arabic and Turkish stemmers. testsuite: + Fix duplicate test in apitest closedb10 testcase. Patch from Guruprasad Hegde. glass backend: * A long-lived cursor on a table in a WritableDatabase could get into an invalid state, which typically resulted in a DatabaseCorruptError being thrown with the message: Db block overwritten - are there multiple writers? But in fact the on-disk database is not corrupted - it's just that the cursor in memory has got into an inconsistent state. It looks like we'll always detect the inconsistency before it can cause on-disk corruption but it's hard to be completely certain. The bug is in code to rebuild the cursor when the underlying table changes in ways which require that, which is a fairly rare occurrence to start with, and only triggers when a block in the cursor has been released, reallocated, and we tried to load it in the cursor at the same level - the cursor wrongly assumes it has the current version of the block. Reported with a reproducer by Sylvain Taverne. Confirmed by David Bremner as also fixing a problem in notmuch for which he hadn't managed to find a reduced reproducer. documentation: * INSTALL: Document need to have MSVC command line tools on PATH. portability: * Cygwin: Work around oddity where unlink() sometimes seems to indicate failure with errno set to ECHILD. Xapian-core 1.4.6 (2018-07-02): API: * API classes now support C++11 move semantics when using a compiler which we are confident supports them (currently compilers which define __cplusplus >= 201103 plus a special check for MSVC 2015 or later). C++11 move semantics provide a clean and efficient way for threaded code to hand-off Xapian objects to worker threads, but in this case it's very unhelpful for availability of these semantics to vary by compiler as it quietly leads to a build with non-threadsafe behaviour. To address this, user code can #define XAPIAN_MOVE_SEMANTICS before #include to force this on, and will then get a compilation failure if the compiler lacks suitable support. * MSet::snippet(): + We were only escaping output for HTML/XML in some cases, which would potentially allow HTML to be injected into output (this has been assigned CVE-2018-0499). + Include certain leading non-word characters in snippets. Previously we started the snippet at the start of the first actual word, but there are various cases where including non-word characters in front of the actual word adds useful context or otherwise aids comprehension. Reported by Robert Stepanek in https://github.com/xapian/xapian/pull/180 * Add MSetIterator::get_sort_key() method. The sort key has always been available internally, but wasn't exposed via the public API before, which seems like an oversight as the collapse key has long been available. Reported by 张少华 on xapian-discuss. * Database::compact(): + Allow Compactor::resolve_duplicate_metadata() implementations to delete entries. Previously if an implementation returned an empty string this would result in a user meta-data entry with an empty value, which isn't normally achievable (empty meta-data values aren't stored), and so will cause odd behaviour. We now handle an empty returned value by interpreting it in the natural way - it means that the merged result is to not set a value for that key in the output database. + Since 1.3.5 compacting a WritableDatabase with uncommitted changes throws Xapian::InvalidOperationError when compacting to a single-file glass database. This release adds similar checks for chert and when compacting to a multiple-file glass database. + In the unlikely event that the total number of documents or the total length of all documents overflow when trying to compact a multi-database, we throw an exception. This is now a DatabaseError exception instead of a const char* exception (a hang-over from before this code was turned into a public API in the library). * Document::remove_term(): Handle removing term at current TermIterator position - previously the underlying iterator was invalidated, leading to undefined behaviour (typically a segmentation fault). Reported by Gaurav Arora. * TermIterator::get_termfreq() now always returns an exact answer. Previously for multi-databases we approximated the result, which is probably either a hang-over from when this method was used during Enquire::get_eset(), or else due to a thinking that this method would be used in that situation (it certainly is not now). If the user creates a TermIterator object and asks it for term frequencies then we really should give them the correct answer - it isn't hugely costly and the documentation doesn't warn that it might be approximated. * QueryParser::parse_query(): + Now adds a colon after the prefix when prefixing a boolean term which starts with a colon. This means the mapping is reversible, and matches what omega actually does in this case when it tries to reverse the mapping. Thanks to Andy Chilton for pointing out this corner case. + The parser now makes use of newer features in the lemon parser generator to make parsing faster and use less memory. * Enquire::get_mset(): Fix bug with get_mset(0, 0, X) when X > 0 which was causing an attempt to access an element in an empty vector. Reported by sielicki in #xapian. * Stem: + Add Indonesian stemming algorithm. + Small optimisations to almost all stemming algorithms. * Stopper: + Add Indonesian stopword list. + The installed version of the Finnish stopword list now has one word per line. Previously it had several space-separated words on some lines, which works with C++'s std::istream_iterator but may be inconvenient for use from some other languages. + The installed versions of stopword lists are now sorted in byte order rather than whatever collation order is specified by LC_COLLATE or similar at build time. This makes the build more reproducible, and also may be more efficient for loading into some data structures. * WritableDatabase::replace_document(term, doc): Check for last_docid wrapping when used on a sharded database. * Database::locked(): Consistently throw FeatureUnavailableError on platforms where we can't test for a database lock without trying to take it. Previously GNU Hurd threw DatabaseLockError while platforms where we don't use fcntl() locking at all threw UnimplementedError. * Database and WritableDatabase constructors: Fix handling of entries for disabled backends in stub database files to throw FeatureUnavailableError instead of DatabaseError. * Database::get_value_lower_bound() now works correctly for sharded databases. Previously it returned the empty string if any shard had no values in the specified slot. * PostingIterator was failing to keep an internal reference to the parent Database object for sharded databases. * ValueIterator::skip_to() and check() had an off-by-one error in their docid calculations in some cases with sharded databases. testsuite: * apitest: + Enable testcases flagged metadata, synonym and/or writable to run on sharded databases. + Enable testcases flagged writable to run on sharded databases. Writing to a sharded WritableDatabase has been supported since 1.3.2, but the test harness wasn't running many of the tests that could be with a sharded WritableDatabase. This uncovered three bugs which are fixed in this release. + Support "generated" testcases for the inmemory backend, which uncovered a bug which is fixed in this release. + Skip testcase testlock1 on platforms that don't allow us to implement Database::locked() (which notably include GNU Hurd and Microsoft Windows). + Disable testlock2 on sharded databases as it fails for platforms which don't actually support testing the lock. + Extend tests of behaviour after database close. Patch from Guruprasad Hegde. Fixes https://trac.xapian.org/ticket/337 + Enable testcase closedb5 for remote backends. This testcase failed for remote backends when it was added and the cause wasn't clear, but it turns out it was actually a bug in the disk based backends, which was fixed way back in 2010. Reported by Guruprasad Hegde. + Check for select() failing in retrylock1 testcase. Retry on EINTR or EAGAIN, and report other errors rather than trying the read() anyway. Previously the read() would likely fail for the same reason the select() did, but at best this is liable to make what's going on less clear if the testcase fails. * Report bool values as true/false not 1/0. * Assorted minor testcase improvements. * The test harness now supports testcases which are expected to fail (XFAIL). Based on patch from Richard Boulton in https://trac.xapian.org/ticket/156. * Fix demangling of std::exception subclass names which wasn't happening due to a typo in the preprocessor check for the required header. This was broken by changes in 1.4.2. * Make TEST_EQUAL() arguments side-effect free. The TEST_EQUAL() macro evaluates its arguments a second time if the test fails in order to report their values. This isn't ideal and really ought to be addressed, but for now fix uses where the argument has side-effect (e.g. *i++) such that the reported value should match the tested value. * runtest: Show usage if first option starts '-'. Previously we ended up passing such options to libtool, so putting -v on runtest instead of apitest would run the tests but -v would effectively do nothing (it would make libtool verbose, but that doesn't make any difference in this case): ./runtest -v ./apitest * Suppress output from xcopy on MS Windows. * The test harness machinery for detecting file descriptor leaks should now work on any platform which has /dev/fd. * Implement recursive delete of a database directory in the test harness using nftw() if available (and not buggy like mingw64's seems to be), rather than running "rm -rf" as an external command. This avoids the overhead of starting a new process each time we clean up a test database, which happens a lot during a test run. * Speed up generated test databases a little by adding a stat() check to avoid throwing and catching an exception when the database doesn't yet exist. * Skip timed tests when configured with --enable-log. The logging can easily turn O(1) operations into O(n), and that's hard to avoid. Fixes https://trac.xapian.org/ticket/757, reported by Guruprasad Hegde. matcher: * OP_VALUE_*: When a value slot's lower and upper bound are equal, we know that exactly how many documents the subquery can match (either 0 or those bounds). This also avoids a division by zero which previously happened when trying to calculate the estimate. * Speed up sorting by keys. Use string::compare() to avoid having to call operator< if operator> returns false. * Fix clamping of maxitems argument to get_mset() - it was being clamped to db.get_doccount(), now it's clamped to db.get_doccount() - first. In practice this doesn't actually seem to cause any issues. * If a match time limit is in effect, when it expires we now clamp check_at_least to first + maxitems instead of to maxitems. In practice this also doesn't seem to actually cause any issues (at least we've failed to construct a testcase where it actually makes an observable difference). * Fix percentages when only some shards have positions. If the final shard didn't have positions this would lead to under-counting the total number leaf of subqueries which would lead to incorrect positional calculations (and a division by zero if the top level of the query was positional. This bug was introduced in 1.4.3. * OP_NEAR: Fix "phantom positions", where OP_NEAR would think a term without positional information occurred at position 1 if it had the lowest term frequency amongst the OP_NEAR's subqueries. * Fix termfreq used in weight calculations for a term occurring more than once in the query. Previously the termfreq for such terms was multiplied by the number of different query positions they appeared at. * OP_SYNONYM: We use the doclength upper bound for the wdf upper bound of a synonym - now we avoid fetching it twice when the doclength upper bound is explicitly needed. * Short-cut init() when factor is 0 in most Weight subclasses. This indicates the object is for the term-independent weight contribution, which is always 0 for most schemes, so there's no point fetching any stats or doing any calculations. This fixes a divide by zero for TfIdfWeight, detected by UBSan. * OP_OR: Fix bug which caused orcheck1 to fail once hooked up to run with the inmemory backend. glass backend: * Fix glass freelist bug when changes to a new database which didn't modify the termlist table were committed. In this corner case, a block which had been allocated to be the root block in the termlist table was leaked. This was largely harmless, except that it was detected by Database::check() and caused it to report an error. Reported by Antoine Beaupré and David Bremner. * Fix glass freelist bug with cancel_transaction(). The freelist wasn't reset to how it was before the transaction, resulting in leaked blocks. This was largely harmless, except that it was detected by Database::check() and caused it to report an error. * Improve the per-term wdf upper bound. Previously we used min(cf(term), wdf_upper_bound(db)) which is tight for any terms which attain that upper bound, and also for terms with termfreq == 1 (the latter are common in the database (e.g. 66% for a database of wikipedia), but probably much less common in searches). When termfreq > 1 we now use max(first_wdf(term), cf(term) - first_wdf(term)), which means terms with termfreq == 2 will also attain their bound (another 11% for the same database) while terms with higher termfreq but below the global bound will get a tighter bound. * Fix Database::locked() on single-file glass db to just return false (such databases can't be opened as a WritableDatabase so there can't be a write lock). Previously this failed with: "DatabaseLockError: Unable to get write lock on /flintlock: Testing lock" * Fix compaction when both the input and output are specified as a file descriptor. Previously this threw an exception due to an overeager check that destination != source. * Use O_TRUNC when compacting to single file. If the output already exists but is larger than our output we don't want to just overwrite the start of it. This case also used to result in confusing compaction percentages. * Enable glass's "open_nearby_postlist" optimisation (which especially helps large wildcard queries) for writable databases without any uncommitted changes as well. * Make get_unique_terms() more efficient for glass. We approximate get_unique_terms() by the length of the termlist (which counts boolean terms too) but clamp this to be no larger than the document length. Since we need to open the termlist to get its length, it makes more sense to get the document length from that termlist for no extra cost rather than looking it up in the postlist table. * Database::check() now checks document lengths against the stored document length lower and upper bounds. Patch from Uppinder Chugh. Fixes https://trac.xapian.org/ticket/617. * Fix bogus handling of most-recently-read value slot statistics. It seems that we get lucky and this can't actually cause a problem in practice due to another layer of caching above, but if nothing else it's a bug waiting to happen. * If we fail to create the directory for a new database because the path already exists, the exception now reports EEXIST as the errno value rather than whatever errno value happened to be set from an earlier library call. remote backend: * xapian-tcpsrv --one-shot no longer forks. We need fork to handle multiple concurrent connections, but when handling a single connection forking just adds overhead and potentially complicates process management for our caller. This aligns with the behaviour under __WIN32__ where we use threads instead of forking, and service the connection from the main thread with --one-shot. * Fix repeat call to ValueIterator::check() on the same docid to not always set valid to true for remote backend. inmemory backend: * Fix repeat call to ValueIterator::check() on the same docid to not always set valid to true for inmemory backend. build system: * configure: Fix potentially confusing messages suggesting snprintf was added in C90 - it was actually standardised in C99. * Eliminate configure probes related to off_t by using C++11 features. * The installed xapian-config script is now cleaned up by removing code to handle use before installation. This extra code contained build paths which meant the build wasn't bit-for-bit reproducible unless the same build directory name was used. This change also eliminates use of automake's $(transform) (which seems to be intended an internal mechanism) and fixes "make uninstall" to remove xapian-config when a program-prefix or -suffix is in use (e.g. there's a default -1.5 suffix for git master currently). * Directory separator knowledge is now factored out into configure, based on $host_os and __WIN32__ (it seems hard to probe for this in a way which works when cross-compiling). * Fix build with --disable-backend-remote. * In an out-of-tree build configured with --enable-maintainer-mode and --disable-dependency-tracking we would fail to create the "tests/soaktest" and "unicode" directories in the build directory. Patch from Gaurav Arora. * Improve handling of multitarget rule stamp files. Clean them on "make maintainer-clean" and ship them so that --enable-maintainer-mode when building from a tarball doesn't needlessly rerun the multitarget rules. * Split out allsnowballheaders.h again to avoid include path issues with unittest in out-of-tree maintainer-mode builds. * xapian-core.pc: Both the Name and Description were too long compared to pkg-config norms, and the Description was trying to be multi-line which it seems pkg-config doesn't support. Fixes https://github.com/xapian/xapian/pull/203, reported by orbea. documentation: * Stop describing Xapian as "Probabilistic" - we've also had non-probabilistic weighting schemes since 1.3.2. * Improve API docs for MSet::snippet(). * Correct some class names in doxygen file documentation comments. * Mark up shell command as code-block:: sh. tools: * xapian-delve: + Document values can contain binary data, so escape them by default for output. Other options now supported are to decode as a packed integer (like omindex uses for last modified), decode using Xapian::sortable_unserialise(), and to show the raw form (which was the previous behaviour). + Report current database revision. * xapian-inspect: + Report entry count when opening table + Support inspecting single file DBs via a new --table option (which can also be used with a non-single-file DB instead of specifying the path to the table). + Add "first" and "last" commands which jump to the first/last entry in the current table respectively. + "until" now counts and reports the number of entries advanced by. + Document "until" with no arguments - this advances to the end of the table, but wasn't mentioned in the help. + Commands "goto" and "until" which take a key as an argument now expect the key in the same escaped form that's used for display. This makes it much simpler to interact with tables with binary keys. + Fix to expect .glass not .DB extension of glass tables. portability: * Sort out building using MSVC with the standard build system, and fix assorted problems. MSVC 2015 or later is required for decent C++11 support. Both 32- and 64-bit builds are now supported. * Remove code specific to old MSVC nmake build system. The latter has been removed already. * Don't use WIN32 API to parse/unparse UUIDs. So much glue code is needed that it's simpler to just do the parsing and unparsing ourselves, and we already have an implementation which is used when generating UUIDs using /proc on Linux. We still use UuidCreate() to generate a new UUID. * Improve compiler visibility attribute detection to check that using the attributes doesn't result in a warning - previously we'd enable them even on platforms which don't support them, which would result in a compiler warning for every file compiled. We now probe for -fvisibility=hidden and -fvisibility-inlines-hidden together as it seems all compilers implement both or neither, and it's faster to do one probe instead of two. * Don't pass the same FDSET twice in same select() - this appears not to be allowed by current POSIX, and causes warnings with GCC8. * Fix compacttofd testcases to specify O_BINARY so they pass on platforms where O_BINARY matters. * configure: Probe for declaration of _putenv_s. It seems that the symbol is always present in the MSVCRT DLL, but older mingw may not provide a declaration for it. * Fix "may be used uninitialised" warning with GCC 4.9.2 and -Os. * Suppress mingw32 deprecation warning for useconds_t. We've already switched away from useconds_t on git master, but it's not easy to do for 1.4.x without ABI breakage. * Fix signed vs unsigned warnings with assertions on. * Use $(SED) instead of hard-coding "sed". The rules concerned are all ones that only maintainers currently need to run, but we're likely to enable maintainer-mode by default at some point and then portability here will matter more. * Add missing explicit for std::max()/std::min(). * Check for EAGAIN as well as EINTR from select(). The Linux select(2) man page says: "Portable programs may wish to check for EAGAIN and loop, just as with EINTR" and that seems to be necessary for Cygwin at least. * Probe for exp10() declaration as Cygwin seems to have the symbol but lacks a declaration in the headers. Just ignoring it is simplest and we'll use GCC's __builtin_exp10() instead. * Fix warnings when building Snowball compiler with recent GCC. * Fix Perl script used during maintainer builds to work with Perl < 5.10. Such old perl versions shouldn't really be relevant for maintainer builds at this point, but appveyor's mingw install has such a Perl version. * Remove unused macro STATIC_ASSERT_TYPE_DOMINATES (unused, except by internaltest unit test for it, since the flint backend was removed in 2011) and replace uses of STATIC_ASSERT_UNSIGNED_TYPE with C++11 features static_assert and std::is_unsigned instead. * Don't retry on (errno == EINTR) when read() or pread() indicates end-of-file. This could potentially have put us into an infinite loop if we encountered this situation and errno happened to be EINTR from a previous library call. * Make read-only data arrays consistently static and const. * Avoid casting invalid value to enum reply_type if an invalid reply code is received from a remote server. This is technically undefined behaviour, though in practice probably not a problem. * Eliminate an array of function pointers and some char* array members in library, reducing the number of relocations needed at shared library load time, which reduces the total time to load the library. packaging: * Use https for tarball URLs in .spec files. This provides protection against MITM attacks on people building packages using these spec files, and is also slightly more efficient as the http: URLs redirect to the https: versions anyway. debug code: * Fix build when configured with --enable-log due to bugs in debug logging annotations. Patch from Uppinder Chugh. * Fix assertion for value range on empty slot. * Use AssertEq() rather than Assert with ==, the former reports the two values if the assertion fails. Xapian-core 1.4.5 (2017-10-16): API: * Add Database::get_total_length() method. Previously you had to calculate this from get_avlength() and get_doccount(), taking into account rounding issues. But even then you couldn't reliably get the exact value when total length is large since a double's mantissa has more limited precision than an unsigned long long. * Add Xapian::iterator_rewound() for bidirectional iterators, to test if the iterator is at the start (useful for testing whether we're done when iterating backwards). * DatabaseOpeningError exceptions now provide errno via get_error_string() rather than turning it into a string and including it in the exception message. * WritableDatabase::replace_document(): when passed a Document object which came from a database and has unmodified values, we used to always read those values into a memory structure. Now we only do this if the document is being replaced to the same document ID which it came from, which should make other cases a bit more efficient. * Enquire::get_eset(): When approximating term frequencies we now round to the nearest integer - previously we always rounded down. testsuite: * Improve Xapian::Document test coverage. * Pass --child-silent-after-fork=yes to valgrind which stops us creating a .valgrind.log.* file for every remote testcase run. This option was added in valgrind 3.3.0 which is already the minimum version we support. * Open and unlink valgrind log before option parsing so we no longer leave a log file behind if there's an error parsing options or for options like --help which report and exit. * Delete .valgrind.log.* on "make clean" - if tests are run under valgrind and the test is killed at just the wrong moment then a log file may be left behind. * Fix the NetworkError with ECHILD check added in 1.4.4 - this will no longer segfault if the test harness catches a NetworkError without an error string. matcher: * Iterating of positions has been sped up, which means phrase matching is now faster (by a little over 5% in some simple tests). * Fix use after free of QueryOptimiser hint in certain cases involving multiple databases only some of which have positional information. This bug was introduced by changes in xapian-core 1.4.3. Fixes #752, reported and analysed by Robert Stepanek. * An unweighted OP_AND_MAYBE is now optimised to just its left branch - the other branch or branches only contribute weight, so can be completely ignored when the operator is unweighted. inmemory backend: * Use binary chop instead of linear search in all places where we're searching for a term or document - we weren't taking advantage of the sorted order everywhere. build system: * xapian-core.pc: Specify Libs.private in pkgconfig file, which is needed for static linking, and probably also for shared libraries on platforms without DT_NEEDED or something equivalent. Fixes #751, reported by Matthieu Gautier. documentation: * Document that QueryParser::set_default_op() supports OP_MAX - this has been the case since OP_MAX was added, but the API docs for set_default_op() weren't updated to reflect this. * Document OP_MAX and OP_WILDCARD. * Fix documentation of TermGenerator stop_strategy values STOP_ALL and STOP_STEMMED. Reported by Matthieu Gautier in #750. Thanks to Gaurav Arora for additional investigation. * net/remote_protocol.rst: Update the current version of the remote protocol version (39 not 38). The differences between the two are only in the Query and MSet serialisations which aren't documented in detail here. * Link get_unique_terms_begin() and get_terms_begin() API documentation - the cross-referencing is useful in itself, but also helps to highlight the difference between the two. * Fix "IPv5" -> "IPv6" comment typo. Noted by James Clarke * deprecation.html: + Add deprecated Enquire::get_eset() overload - this was marked as deprecated in the header file, but hadn't been added here. + Move deprecated typedefs to the "to be removed" list - they'd been accidentally added to the "removed" list. + Improve descriptions of several deprecated features. * QueryParser::set_max_expansion() is now discussed in the API documentation instead of the deprecated set_max_wildcard_expansion(). * Clarify PostList::check() API documentation: If valid is set to false, then NULL must be returned (pruning in this situation doesn't make sense) and at_end() shouldn't be called (because it implicitly depends on the current position being valid). * HACKING: + Update re -Wold-style-cast which we enabled and then had to disable again. + Update links to C++ FAQ and libstdc++'s debug mode. + Update several URLs to use https. + The 1.2 release branch has now been retired, so remove 1.2-specific backporting tips. portability: * Also check for sys_nerr and sys_errlist. This is probably a more common location for them than Linux's (even on Linux the man page says they're in but that doesn't match reality). * Use $(CC) not $(CC_FOR_BUILD) to build zlib-vg.so. The test for whether we need it is based on the host OS, so it makes more sense to use the host compiler to build it when cross compiling. * On Hurd F_GETLK currently always fails with errno set to ENOSYS - treat this the same way as ENOLCK. This fixes the testsuite on GNU Hurd, broken since the addition on Database::locked() in 1.4.3. * Add missing #include "safesyssocket.h", needed on at least FreeBSD to get AF_INET and SOCK_STREAM defined. Fixes https://github.com/xapian/xapian/pull/154, reported by Po-Chuan Hsieh (alternative fix applied was suggested by James Aylett). * configure: Fixed the probe for whether the test harness can use RTTI with IBM's xlC compiler (which defaults to not generating RTTI). Previously the probe would always think RTTI was available. debug code: * Fix some incorrect class/method names in debug logging. * Stop disabling ccache for coverage builds as ccache 3.2.2 now supports caching compilations with --coverage, and they work as far back as ccache 3.0 (caching is automatically disabled by these older versions). * Drop --enable-quiet from in COVERAGE_CONFIGURE - this option no longer does anything since 1.3.1. Xapian-core 1.4.4 (2017-04-19): API: * Database::check(): + Fix checking a single table - changes in 1.4.2 broke such checks unless you specified the table without any extension. + Errors from failing to find the file specified are now thrown as DatabaseOpeningError (was DatabaseError, of which DatabaseOpeningError is a subclass so existing code should continue to work). Also improved the error message when the file doesn't exist is better. * Drop OP_SCALE_WEIGHT over OP_VALUE_RANGE, OP_VALUE_GE and OP_VALUE_LE in the Query constructor. These operators always return weight 0 so OP_SCALE_WEIGHT over them has no effect. Eliminating it at query construction time is cheap (we only need to check the type of the subquery), eliminates the confusing "0 * " from the query description, and means the OP_SCALE_WEIGHT Query object can be released sooner. Inspired by Shivanshu Chauhan asking about the query description on IRC. * Drop OP_SCALE_WEIGHT on the right side of OP_AND_NOT in the Query constructor. OP_AND_NOT takes no weight from the right so OP_SCALE_WEIGHT has no effect there. Eliminating it at query construction time is cheap (just need to check the subquery's type), eliminates the confusing "0 * " from the query description, and means the OP_SCALE_WEIGHT object can be released sooner. testsuite: * Add more tests of Database::check(). Fixes #238, reported by Richard Boulton. * Make apitest testcase nosuchdb1 fail if we manage to open the DB. * Skip testcases which throw NetworkError with errno value ECHILD - this indicates system resource starvation rather than a Xapian bug. Such failures are seen on Debian buildds from time to time, see: https://bugs.debian.org/681941 matcher: * Fix incorrect results due to uninitialised memory. The array holding max weight values in MultiAndPostList is never initialised if the operator is unweighted, but the values are still used to calculate the max weight to pass to subqueries, leading to incorrect results. This can be observed with an OR under an unweighted AND (e.g. OR under AND on the right side of AND_NOT). The fix applied is to simply default initialise this array, which should lead to a max weight of 0.0 being passed on to subqueries. Bug reported in notmuch by Kirill A. Shutemov, and forwarded by David Bremner. documentation: * Correct "Query::feature_flag" -> "QueryParser::feature_flag". Fixes #747, reported by James Aylett. * Rename set_metadata() `value` parameter to `metadata`. This change is particularly motivated by making it easier to map this case specially in SWIG bindings, but the new name is also clearer and better documents its purpose. * Rename value range parameters. The new names (`range_limit` instead of `limit`, `range_lower` instead of `begin` and `range_upper` instead of `end`) are particularly motivated by making it easier to map them specially in SWIG bindings, but they're also clearer names which better document their purposes. * Change "(key, tag)" to "(key, value)" in user metadata docs. The user metadata is essentially what's often called a "key-value store" so users are likely to be familiar with that terminology. * Consistently name parameter of Weight::unserialise() overridden forms. In xapian/weight.h it was almost always named `serialised`, but LMWeight named it `s` and CoordWeight omitted the name. * Fix various minor documentation comment typos. portability: * Fix configure probe for __builtin_exp10() to work around bug on mingw - there GCC generates a call to exp10() for __builtin_exp10() but there is no exp10() function in the C library, so we get a link failure. Use a full link test instead to avoid this issue. Reported by Mario Emmenlauer on xapian-devel. * Fix configure probe for log2() which was failing on at least some platforms due to ambiguity between overloaded forms of log2(). Make the probe explicitly check for log2(double) to avoid this problem. * Workaround the unhelpful semantics of AI_ADDRCONFIG on platforms which follow the old RFC instead of POSIX (such as Linux) - if only loopback networking is configured, localhost won't resolve by name or IP address, which causes testsuites using the remote backend over localhost to fail in auto-build environments which deliberately disable networking during builds. The workaround implemented is to check if the hostname is "::1", "127.0.0.1" or "localhost" and disable AI_ADDRCONFIG for these. This doesn't catch all possible ways to specify localhost, but should catch all the ways these might be specified in a testsuite. Fixes https://bugs.debian.org/853107, reported by Daniel Schepler and the root cause uncovered by James Clarke. debug code: * Adjust assertion in InMemoryPostList. Calling skip_to() is fine when the postlist hasn't been started yet (but the assertion was failing for a term not in the database). Latent bug, triggered by testcases complexphrase1 and complexnear1 as updated for addition of support for OP_OR subqueries of OP_PHRASE/OP_NEAR. Xapian-core 1.4.3 (2017-01-25): API: * MSet::snippet(): Favour candidate snippets which contain more of a diversity of matching terms by discounting the relevance of repeated terms using an exponential decay. A snippet which contains more terms from the query is likely to be better than one which contains the same term or terms multiple times, but a repeated term is still interesting, just less with each additional appearance. Diversity issue highlighted by Robert Stepanek's patch in https://github.com/xapian/xapian/pull/117 - testcases taken from his patch. * MSet::snippet(): New flag SNIPPET_EMPTY_WITHOUT_MATCH to get an empty snippet if there are no matches in the text passed in. Implemented by Robert Stepanek. * Round MSet::get_matches_estimated() to an appropriate number of significant figures. The algorithm used looks at the lower and upper bound and where the estimate sits between them, and then picks an appropriate number of significant figures. Thanks to Sébastien Le Callonnec for help sorting out a portability issue on OS X. * Add Database::locked() method - where possible this non-invasively checks if the database is currently open for writing, which can be useful for dashboards and other status reporting tools. testsuite: * Use terms that exist in the database for most snippet tests. It's good to test that snippet highlighting works for terms that aren't in the database, but it's not good for all our snippet tests to feature such terms - it's not the common usage. matcher: * Improve value range upper bound and estimated matches. The value slot frequency provides a tighter upper bound than Database::get_doccount(). The estimate is now calculated by working out the proportion of possible values between the slot lower and upper bounds which the range covers (assuming a uniform distribution). This seems to work fairly well in practice, and is certainly better than the crude estimate we were using: Database::get_doccount() / 2 * Handle arbitrary combinations of OP_OR under OP_NEAR/OP_PHRASE, partly addressing #508. Thanks to Jean-Francois Dockes for motivation and testing. * Only convert OP_PHRASE to OP_AND if full DB has no positions. Until now the conversion was done independently for each sub-database, but being consistent with the results from a database containing all the same documents seems more useful. * Avoid double get_wdf() call for first subquery of OP_NEAR and OP_PHRASE, which will speed them up by a small amount. documentation: * INSTALL: Update section about -Bsymbolic-functions which is not a new GNU ld feature at this point. tools: * xapian-delve: Uses new Database::locked() method to report if the database is currently locked. portability: * Fix build failure cross-compiling for android due to not pulling in header for errno. * Fix compiler warnings. Xapian-core 1.4.2 (2016-12-26): API: * Add XAPIAN_AT_LEAST(A,B,C) macro. * MSet::snippet(): Optimise snippet generation - it's now ~46% faster in a simple test. * Add Xapian::DOC_ASSUME_VALID flag which tells Database::get_document() that it doesn't need to check that the passed docid is valid. Fixes #739, reported by Germán M. Bravo. * TfIdfWeight: Add support for the L wdf normalisation. Patch from Vivek Pal. * BB2Weight: Fix weights when database has just one document. Our existing attempt to clamp N to be at least 2 was ineffective due to computing N - 2 < 0 in an unsigned type. * DPHWeight: Fix reversed sign in quadratic formula, making the upper bound a tiny amount higher. * DLHWeight: Correct upper bound which was a bit too low, due to flawed logic in its derivation. The new bound is slightly less tight (by a few percent). * DLHWeight,DPHWeight: Avoid calculating log(0) when wdf is equal to the document length. * TermGenerator: Handle stemmer returning empty string - the Arabic stemmer can currently do this (e.g. for a single tatweel) and user stemmers can too. Fixes #741, reported by Emmanuel Engelhart. * Database::check(): Fix check that the first docid in each doclength chunk is more than the last docid in the previous chunk - this code was in the wrong place so didn't actually work. * Database::get_unique_terms(): Clamp returned value to be <= document length. Ideally get_unique_terms() ought to only count terms with wdf > 0, but that's expensive to calculate on demand. glass backend: * When compacting we now only write the iamglass file out once, and we write it before we sync the tables but sync it after, which is more I/O friendly. * Database::check(): Fix in SEGV when out == NULL and opts != 0. * Fix potential SEGV with corrupt value stats. chert backend: * Fix potential SEGV with corrupt value stats. build system: * Add XO_REQUIRE autoconf macro to provide an easy way to handle version checks in user configure scripts. tools: * quest: Support BM25+, LM and PL2+ weighting schemes. * xapian-check: Fix when ellipses are shown in 't' mode. They were being shown when there were exactly 6 entries, but we only start omitting entries when there are *more* than 6. Fix applies to both glass and chert. portability: * Avoid using opendir()/readdir() in our closefrom() implementation as these functions can call malloc(), which isn't safe to do between fork() and exec() in a multi-threaded program, but after fork() is exactly where we want to use closefrom(). Instead we now use getdirentries() on Linux and getdirentriesattr() on OS X (OS X support bugs shaken out with help from Germán M. Bravo). * Support reading UUIDs from /proc/sys/kernel/random/uuid which is especially useful when building for Android, as it avoids having to cross-build a UUID library. * Disable volatile workaround for excess precision SEGV for SSE - previously it was only being disabled for SSE2. * When building for x86 using a compiler where we don't know how to disable use of 387 FP instructions, we now run remote servers for the testsuite under valgrind --tool=none, like we do when --disable-sse is explicitly specified. * Add alignment_cast which has the same effect as reinterpret_cast but avoids warnings about alignment issues. * Suppress warnings about unused private members. DLHWeight and DPHWeight have an unused lower_bound member, which clang warns about, but we need to keep them there in 1.4.x to preserve ABI compatibility. * Remove workaround for g++ 2.95 bug as we require at least 4.7 now. * configure: Probe for . GCC added this header in GCC 3.1, which is much older than we support, so we've just assumed it was available if __GNUC__ was defined. However, clang lies and defines __GNUC__ yet doesn't seem to reliably provide , so we need to probe for it. * Fix "unused assignment" warning. * configure: Probe for __builtin_* functions. Previously we just checked for __GNUC__ being defined, but it's cleaner to probe for them properly - compilers other than GCC and those that pretend to be GCC might provide these too. * Use __builtin_clz() with compilers which support it to speed up encoding and especially decoding of positional data. This speeds up phrase searching by ~0.5% in a simple test. * Check signed right shift behaviour at compile time - we can use a test on a constant expression which should optimise away to just the required version of the code, which means that on platforms which perform sign-extension (pretty much everything current it seems) we don't have to rely on the compiler optimising a portable idiom down to the appropriate right shift instruction. * Improve configure check for log2(). We include so the check really should succeed if only std::log2() is declared. * Enable win32-dll option to LT_INIT. debug code: * xapian-inspect: + Support glass instead of chert. + Allow control of showing keys/tags. + Use more mnemonic letters than X for command arguments in help. Xapian-core 1.4.1 (2016-10-21): API: * Constructing a Query for a non-reference counted PostingSource object will now try to clone the PostingSource object (as happened in 1.3.4 and earlier). This clone code was removed as part of the changes in 1.3.5 to support optional reference counting of PostingSource objects, but that breaks the case when the PostingSource object is on the stack and goes out of scope before the Query object is used. Issue reported by Till Schäfer and analysed by Daniel Vrátil in a bug report against Akonadi: https://bugs.kde.org/show_bug.cgi?id=363741 * Add BM25PlusWeight class implementing the BM25+ weighting scheme, implemented by Vivek Pal (https://github.com/xapian/xapian/pull/104). * Add PL2PlusWeight class implementing the PL2+ weighting scheme, implemented by Vivek Pal (https://github.com/xapian/xapian/pull/108). * LMWeight: Implement Dir+ weighting scheme as DIRICHLET_PLUS_SMOOTHING. Patch from Vivek Pal. * Add CoordWeight class implementing coordinate matching. This can be useful for specialised uses - e.g. to implement sorting by the number of matching filters. * DLHWeight,DPHWeight,PL2Weight: With these weighting schemes, the formulae can give a negative weight contribution for a term in extreme cases. We used to try to handle this by calculating a per-term lower bound on the contribution and subtracting this from the contribution, but this idea is fundamentally flawed as the total offset it adds to a document depends on what combination of terms that document matches, meaning in general the offset isn't the same for every matching document. So instead we now clamp each term's weight contribution to be >= 0. * TfIdfWeight: Always scale term weight by wqf - this seems the logical approach as it matches the weighting we'd get if we weighted every non-unique term in the query, as well as being explicit in the Piv+ formula. * Fix OP_SCALE_WEIGHT to work with all weighting schemes - previously it was ignored when using PL2Weight and LMWeight. * PL2Weight: Greatly improve upper bound on weight: + Split the weight equation into two parts and maximise each separately as that gives an easily solvable problem, and in common cases the maximum is at the same value of wdfn for both parts. In a simple test, the upper bounds are now just over double the highest weight actually achieved - previously they were several hundred times. This approach was suggested by Aarsh Shah in: https://github.com/xapian/xapian/pull/48 + Improve upper bound on normalised wdf (wdfn) - when wdf_upper_bound > doclength_lower_bound, we get a tighter bound by evaluating at wdf=wdf_upper_bound. In a simple test, this reduces the upper bound on wdfn by 36-64%, and the upper bound on the weight by 9-33%. * PL2Weight: Fix calculation of upper_bound when P2>0. P2 is typically negative, but for a very common term it can be positive and then we should use wdfn_lower not wdfn_upper to adjust P_max. * Weight::unserialise(): Check serialised form is empty when unserialising parameter-free schemes BoolWeight, DLHWeight and DPHWeight. * TermGenerator::set_stopper_strategy(): New method to control how the Stopper object is used. Patch from Arnav Jain. * QueryParser: Fix handling of CJK query over multiple prefixes. Previously all the n-gram terms were AND-ed together - now we AND together for each prefix, then OR the results. Fixes #719, reported by Aaron Li. * Add Database::get_revision() method which provides access to the database revision number for chert and glass, intended for use by xapiand. Marked as experimental, so we don't have to go through the usual deprecation cycle if this proves not to be the approach we want to take. Fixes #709, reported by Germán M. Bravo. * Mark RangeProcessor constructor as `explicit`. testsuite: * OP_SCALE_WEIGHT: Check top weight is non-zero - if it is zero, tests which try to check that OP_SCALE_WEIGHT works will always pass. * testsuite: Check SerialisationError descriptions from Xapian::Weight subclasses mention the weighting scheme name. matcher: * Fix stats passed to Weight with OP_SYNONYM. Previously the number of unique terms was never calculated, and a term which matched all documents would be optimised to an all-docs postlist, which fails to supply the correct wdf info. * Use floating point calculation for OR synonym freq estimates. The division was being done as an integer division, which means the result was always getting rounded down rather than rounded to the nearest integer. glass backend: * Fix allterms with prefix on glass with uncommitted changes. Glass aims to flush just the relevant postlist changes in this case but the end of the range to flush was wrong, so we'd only actually flush changes for a term exactly matching the prefix. Fixes #721. remote backend: * Improve handling of invalid remote stub entries: Entries without a colon now give an error rather than being quietly skipped; IPv6 isn't yet supported, but entries with IPv6 addresses now result in saner errors (previously the colons confused the code which looks for a port number). build system: * XO_LIB_XAPIAN: Check for user trying to specify configure for XAPIAN_CONFIG and give a more helpful error. * Fix XO_LIB_XAPIAN to work without libtool. Modern versions of GNU m4 error out when defn is used on an undefined macro. Uncovered by Amanda Jayanetti. * Clean build paths out of installed xapian-config, mostly in the interests of facilitating reproducible builds, but it is also a little more robust as the "uninstalled tree" case can't then accidentally be triggered. * Drop compiler options that are no longer useful: + -fshow-column is the default in all GCC versions we now support (checked as GCC 4.6). + -Wno-long-long is no longer necessary now that we require C++11 where "long long" is a standard type. documentation: * Add API documentation comments for all classes, methods, constants, etc which were lacking them, and improve the content of some existing comments. * Stop hiding undocumented classes and members. Hiding them silences doxygen's warnings about them, so it's hard to see what is missing, and the stub documentation produced is perhaps better than not documenting at all. Fixes #736, reported by James Aylett. * xapian-check: Make command line syntax consistent with other tools. * Note when MSet::snippet() was added. * deprecation.rst: Recommend unsigned over useconds_t for timeout values (but leave the API using useconds_t for 1.4.x for ABI compatibility. The type useconds_t is now obsolete and anyway was intended to represent a time in microseconds (confusing when Xapian's timeouts are in milliseconds). The Linux usleep man page notes: "Programs will be more portable if they never mention this type explicitly." portability: * Suppress compiler warnings about pointer alignment on some architectures. We know the data is aligned in these cases. * Fix replicate7 under Cygwin. debug code: * Add missing forward declaration needed by --enable-log build. Xapian-core 1.4.0 (2016-06-24): API: * Update to Unicode 9.0.0. portability: * Fix build on big-endian architectures. The new unaligned word access functions expect WORDS_BIGENDIAN to be set, but configure.ac wasn't invoking AC_C_BIGENDIAN to arrange for this to be set. * Suppress compiler warnings about pointer alignment. We know the data is suitably aligned, because the whole point of these functions is to allow reading an aligned word. Xapian-core 1.3.7 (2016-06-01): API: * Reimplement ESet and ESetIterator as we did for MSet and MSetIterator in 1.3.5. ESetIterator internally now counts down to the end of the ESet, so the end test is now against 0, rather than against eset.size(). And more of the trivial methods are now inlined, which reduces the number of relocations needed to load the library, and should give faster code which is a very similar size to before. * MSetIterator and ESetIterator are now STL-compatible random_access_iterators (previously they were only bidirectional_iterators). testsuite: * Merge queryparsertest and termgentest into apitest. Their testcases now use the backend manager machinery in the testharness, so we don't have to hard-code use of inmemory and chert backends, but instead run them under all backends which support the required features. This fixes some test failures when both chert and glass are disabled due to trying to run spelling tests with the inmemory backend. * Avoid overflowing collection frequency in totaldoclen1. We're trying to test total document length doesn't wrap, so avoid collection freq overflowing in the process, as that triggers errors when running the testsuite under ubsan. We should handle collection frequency overflow better, but that's a separate issue. * Add some test coverage for ESet::get_ebound(). matcher: * Fix upper bound on matches for OP_XOR. Due to a reversed conditional, the estimate could be one too low in some cases where the XOR matched all the documents in the database. * Improve lower bound on matches for OP_XOR. Previously the lower bound was always set to 0, which is valid, but we can often do better. glass backend: * Fix Database::check() parsing of glass changes file header. In practice this was unlikely to actually cause problems. build system: * --disable-backend-remote now disables replication too which makes it actually usable (currently replication and the remote backend share most of their network code, so disabling them together probably makes sense anyway). * Improve builds with various combinations of backends disabled (see #361). portability: * Revert change to handle a self-initialised PIMPL object (e.g. Xapian::Query q(q);), added in 1.3.6. It seems this case is actually undefined behaviour, so there's not much point trying to do anything about it. Clang warns about the testcase for it (tested with 3.5), but sadly current GCC doesn't (tested with 6.1). * Use for integer types of known widths now we require C++11. * Replace unaligned word access functions with optimised versions which use memcpy() and (on little-endian platforms) a byte-swap (via compiler builtins where available). Access revision numbers in database blocks with an aligned load, since we know they are suitably aligned. * Simplify handling of platforms where timer_create() exists but isn't suitable for our needs - AIX and GNU Hurd both have timer_create() but it always seems to fail (on Hurd this is because there's a dummy implementation in glibc which always fails with ENOSYS). Trying a call at runtime which will never succeed is a waste of time, so we want to avoid defining HAVE_TIMER_CREATE in such cases. Probing for this properly in configure would need us to compile and run a test program, which is unhelpful when cross-compiling, so for now just test against a blacklist of platforms we know don't provide a suitable timer_create() function. * Check _POSIX_MONOTONIC_CLOCK and if it's not defined, use CLOCK_REALTIME instead of CLOCK_MONOTONIC. The existing hard-coded platform checks still seem to be needed, as on these platforms CLOCK_MONOTONIC is available for some functions, but doesn't work with timer_create() for one reason or another. But the new check should avoid failures on platforms without any monotonic clock support. * Make opt_intrusive_base symbols visible to avoid UBSAN warnings. * Avoid potential set-but-unused warning - with both chert and glass disabled, last_docid's final set value isn't used, which GCC doesn't warn about, but other compilers might. * Avoid explicit recursive return of void - we've had warnings for such cases from some compilers in the past, and it's an odd thing to do outside of a template. Xapian-core 1.3.6 (2016-05-09): API: * TfIdfWeight: Support freq and squared IDF normalisations. Patch from Vivek Pal. * New Xapian::Query::OP_INVALID to provide an "invalid" query object. * Reject OP_NEAR/OP_PHRASE with non-leaf subqueries early to avoid a potential segmentation fault if the non-leaf subquery decayed at just the wrong moment. See #508. * Reduce positional queries with a MatchAll or PostingSource subquery to MatchNothing (since these subqueries have no positional information, so the query can't match). * Deprecate ValueRangeProcessor and introduce new RangeProcessor class as a replacement. RangeProcessor()::operator()() method returns Xapian::Query, so a range can expand to any query. OP_INVALID is used to signal that a range is not recognised. Fixes #663. * Combining of ranges over the same quantity with OP_OR is now handled by an explicit "grouping" parameter, with a sensible default which works for value range queries. Boolean term prefixes and FieldProcessor now support "grouping" too, so ranges and other filters can now be grouped together. * Formally deprecate WritableDatabase::flush(). The replacement commit() method was added in 1.1.0, so code can be switched to use this and still work with 1.2.x. * Fix handling of a self-initialised PIMPL object (e.g. Xapian::Query q(q);). Previously the uninitialised pointer was copied to itself, resulting in undefined behaviour when the object was used. This isn't something you'd see in normal code, but it's a cheap check which can probably be optimised away by the compiler (GCC 6 does). testsuite: * Fix testcase notermlist1 to check correct table extension - ".glass" not ".DB" (chert doesn't support DB_NO_TERMLIST). build system: * Bootstrap with autoconf 2.69. This requires GNU m4 >= 4.6, but that should no longer be an issue on developer machines. * Fix build with --enable-log. Debug logging was trying to log compress_strategy parameter which was removed recently. Reported by Ankit Paliwal on xapian-devel. documentation: * Fix misfiled deprecation notes. Various things marked as deprecated and removed in 1.3.x have in fact been deprecated but not removed (they were just added to the wrong list). One instance queried by David Bremner on #xapian, and a review found several more. * Improve docs for lcov makefile targets - say that these are targets in the xapian-core directory (noted by poe_ on #xapian), document coverage-reconfigure-maintainer-mode target, and clarify what the example of how to use GENHTML_ARGS actually does. * Note that Java bindings use xapian/iterator.h. * Update release checklist. The script to build the release tarballs now automates some of the changes needed in trac. portability: * Fix build with Android NDK which declares sys_errlist and sys_nerr in the C library headers, but doesn't actually define them in the library itself. The configure test now tries to link a trivial program which uses these symbols. Patch from Tejas Jogi. Xapian-core 1.3.5 (2016-04-01): This release includes all changes from 1.2.23 which are relevant. API: * The Snipper class has been replaced with a new MSet::snippet() method. The implementation has also been redone - the existing implementation was slower than ideal, and didn't directly consider the query so would sometimes selects a snippet which doesn't contain any of the query terms (which users quite reasonably found surprising). The new implementation is faster, will always prefer snippets containing query terms, and also understands exact phrases and wildcards. Fixes #211. * Add optional reference counting support for ErrorHandler, ExpandDecider, KeyMaker, PostingSource, Stopper and TermGenerator. Fixes #186, reported by Richard Boulton. (ErrorHandler's reference counting isn't actually used anywhere in xapian-core currently, but means we can hook it up in 1.4.x if ticket #3 gets addressed). * Deprecate public member variables of PostingSource. The new getters and/or setters added in 1.2.23 and 1.3.5 are preferred. Fixes #499, reported by Joost Cassee. * Reimplement MSet and MSetIterator. MSetIterator internally now counts down to the end of the MSet, so the end test is now against 0, rather than against mset.size(). And more of the trivial methods are now inlined, which reduces the number of relocations needed to load the library, and should give faster code which is a very similar size to before. * Only issue prefetch hints for documents if MSet::fetch() is called. It's not useful to send the prefetch hint right before the actual read, which was happening since the implementation of prefetch hints in 1.3.4. Fixes #671, reported by Will Greenberg. * Fix OP_ELITE_SET selection in multi-database case - we were selecting different sets for each subdatabase, but removing the special case check for termfreq_max == 0 solves that. * Remove "experimental" marker from FieldProcessor, since we're happy with the API as-is. Reported by David Bremner on xapian-discuss. * Remove "experimental" marker from Database::check(). We've not had any negative feedback on the current API. * Databse::check() now checks that doccount <= last_docid. * Database::compact() on a WritableDatabase with uncommitted changes could produce a corrupted output. We now throw Xapian::InvalidOperationError in this case, with a message suggesting you either commit() or open the database from disk to compact from. Reported by Will Greenberg on #xapian-discuss * Add Arabic stemmer. Patch from Assem Chelli in https://github.com/xapian/xapian/pull/45 * Improve the Arabic stopword list. Patch from Assem Chelli. * Make functions defined in xapian/iterator.h 'inline'. * Don't force the user to specify the metric in the geospatial API - GreatCircleMetric is probably what most users will want, so a sensible default. * Xapian::DBCHECK_SHOW_BITMAP: This was added in 1.3.0 (so has never been in a stable release) and was superseded by Xapian::DBCHECK_SHOW_FREELIST in 1.3.2, so just remove it. * Make setting an ErrorHandler a no-op - this feature is deprecated and we're not aware of anyone using it. We're hoping to rework ErrorHandler in 1.4.x, which will be simpler without having to support the current behaviour as well as the new. See #3. testsuite: * unittest: We can't use Assert() to unit test noexcept code as it throws an exception if it fails. Instead set up macros to set a variable and return if an assertion fails in a unittest testcase, and check that variable in the harness. glass backend: * Make glass the default backend. The format should now be stable, except perhaps in the unlikely event that a bug emerges which requires a format change to address. * Don't explicitly store the 2 byte "component_of" counter for the first component of every Btree entry in leaf blocks - instead use one of the upper bits of the length to store a "first component" flag. This directly saves 2 bytes per entry in the Btree, plus additional space due to fewer blocks and fewer levels being needed as a result. This particularly helps the position table, which has a lot of entries, many of them very small. The saving would be expected to be a little less than the saving from the change which shaved 2 bytes of every Btree item in 1.3.4 (since that saved 2 bytes multiple times for large entries which get split into multiple items). A simple test suggests a saving of several percent in total DB size, which fits that. This change reduces the maximum component size to 8194, which affects tables with a 64KB blocksize in normal use and tables with >= 16KB blocksize with full compaction. * Refactor glass backend key comparison - == and < operations are replaced by a compare() function returns negative, 0 or positive (like strcmp(), memcmp() and std::string::compare()). This allows us to avoid a final compare to check for equality when binary chopping, and to terminate early if the binary chop hits the exact entry. * If a cursor is moved to an entry which doesn't exist, we need to step back to the first component of previous entry before we can read its tag. However we often don't actually read its tag (e.g. if we only wanted the key), so make this stepping back lazy so we can avoid doing it when we don't want to read the tag. * Avoid creating std::string objects to hold data when compressing and decompressing tags with zlib. * Store minimum compression length per table in the version file, with 0 meaning "don't compress". Currently you can only change this setting with a hex editor on the file, but now it is there we can later make use of it without needing a database format change. * Database::check() now performs additional consistency checks for glass. Reported by Jean-Francois Dockes and Bob Cargill via xapian-discuss. * Database::check(): check docids don't exceed db_last_docid when checking a single glass table. * We now throw DatabaseCorruptError in a few cases where it's appropriate but we didn't previously, in particular in the case where all the files in a DB have been truncated to zero size (which makes handling of this case consistent with chert). * Fix compaction to a single file which already exists. This was hanging. Noted by Will Greenberg on #xapian. chert backend: * When using 64-bit Xapian::docid, consistently use the actual maximum valid docid value rather instead of the maximum value the type can hold. build system: * Default to only building shared libraries. Building both shared and static means having to compile the files which make up the library twice on most platforms. Shared libraries are the better option for most users, and if anyone really wants static libraries they can configure with --enable-static (or --enable-static=xapian-core if configuring a combined tree with the bindings). * Fix XAPIAN_TEST_LINKER_FLAG macro to actually test if it's possible to link with the option in LDFLAGS - previously we attempted to guess based on whether the error message from $CXX $flag contained the option name, which doesn't actually work very well. documentation: * Document that OP_WILDCARD expansion limits currently work per sub-db. * Remove reference to ChangeLog files, as we are no longer updating them. * Remove link to apidoc.pdf which we no longer generate this by default. * Clarify LatLongCoord::operator< purpose in API documentation. * Fix documentation comment typo - LatLongDistancePostingSource is a posting source, not a match decider! * HACKING: Recommend lcov 1.11 as it uses much less memory tools: * xapian-replicate: Obviously corrupt replicas now self-heal. If a replica database fails to open with DatabaseCorruptError then a full copy is now forced. portability: * Eliminate arrays of C strings, which result in relocations at library load time, slowing startup and making pages containing them unsharable. * Refactor MSet::fetch() to reduce load time relocations. debug code: * Fix to build when configured with --enable-assertions. * Fix to build when configured with --enable-log. Reported by Tim McNamara on #xapian-discuss. Xapian-core 1.3.4 (2016-01-01): This release includes all changes from 1.2.22 which are relevant. API: * Update to Unicode 8.0.0. Fixes #680. * Overhaul database compaction API. Add a Xapian::Database::compact() method, with the Database object specifying the source database(s). Xapian::Compactor is now just a functor to use if you want to control progress reporting and/or the merging of user metadata. The existing API has been reimplemented using the new one, but is marked as deprecated. * Add support for a default value when sorting. Fixes #452, patch from Richard Boulton. * Make all functor objects non-copyable. Previously some were, some weren't, but it's hard to correctly make use of this ability. Fixes #681. * Fix use after free with WILDCARD_LIMIT_MOST_FREQUENT. If we tried to open a postlist after processing such a wildcard, the postlist hint could be pointing to a PostList object which had been deleted. Fixes #696, reported by coventry. * Add support for optional reference counting of MatchSpy objects. * Improve Document::get_description() - the output is now always valid UTF-8, doesn't contain implementation details like "Document::Internal", and more clearly reports if the document is linked to a database. * Remove XAPIAN_CONST_FUNCTION marker from sortable_serialise_() helper, as it writes to the passed in buffer, so it isn't const or pure. Fixes decvalwtsource2 testcase failure when compiled with clang. * Make PostingSource::set_maxweight() public - it's hard to wrap for the bindings as a protected method. Fixes #498, reported by Richard Boulton. testsuite: * Add unit test for internal C_isupper(), etc functions. matcher: * Optimise value range which is a superset of the bounds. If the value frequency is equal to the doccount, such a range is equivalent to MatchAll, and we now avoid having to read the valuestream at all. * Optimise OP_VALUE_RANGE when the upper bound can't be exceeded. In this case, we now use ValueGePostList instead of ValueRangePostList. glass backend: * Shave 2 bytes of every Btree item (which will probably typically reduce database size by several percent). * More compact item format for branch blocks - 2 bytes per item smaller. This means each branch block can branch more ways, reducing the number of Btree levels needed, which is especially helpful for cold-cache search times. * Track an upper bound on spelling word frequency. This isn't currently used, but will be useful for improving the spelling algorithm, and we want to stabilise the glass backend format. See #225, reported by Philip Neustrom. * Support 64-bit docids in the glass backend on-disk format. This changes the encoding used by pack_uint_preserving_sort() to one which supports 64 bit values, and is a byte smaller for values 16384-32767, and the same size for all other 32 bit values. Fixes #686, from original report by James Aylett. * Use memcpy() not memmove() when no risk of overlap. * Store length of just the key data itself, allowing keys to be up to 255 bytes long - the previous limit was 252. * Change glass to store DB stats in the version file. Previously we stored them in a special item in the postlist table, but putting them in the version file reduces the number of block reads required to open the database, is simpler to deal with, and means we can potentially recalculate tight upper and lower bounds for an existing database without having to commit a new revision. * Add support for a single-file variant for glass. Currently such databases can only be opened for reading - to create one you need to use xapian-compact (or its API equivalent). You can embed such databases within another file, and open them by passing in a file descriptor open on that file and positioned at the offset the database starts at). Database::check() also supports them. Fixes #666, reported by Will Greenberg (and previously suggested on xapian-discuss by Emmanuel Engelhart). * Avoid potential DB corruption with full-compaction when using 64K blocks. * Where posix_fadvise() is available, use it to prefetch postlist Btree blocks from the level below the root block which will be needed for postlists of terms in the query, and similarly for the docdata table when MSet::fetch() is called. Based on patch by Will Greenberg in #671. chert backend: * Where posix_fadvise() is available, use it to prefetch postlist Btree blocks from the level below the root block which will be needed for postlists of terms in the query, and similarly for the record table when MSet::fetch() is called. Based on patch by Will Greenberg in #671. remote backend: * Fix hook for remote support of user weighting schemes. The commented-out code used entirely the wrong class - now we use the server object we have access to, and forward the method to the class which needs it. build system: * New configure options --enable-64bit-docid and --enable-64bit-termcount, which control the size of these types. Because these types are used in the API, libraries built with different combinations of them won't be ABI compatible. Based heavily on patch from James Aylett and Dylan Griffith. Fixes #385. * Sort out hiding most of the internal symbols which had public visibility for various reason. Mostly addresses #63. tools: * xapian-inspect: We no longer install this - it's really an aid to Xapian development rather than a user tool. portability: * Minimum supported GCC version is now documented as GCC 4.7, for C++11 support. Previously we documented 4.7 as the oldest known to work. * Use CLOCK_REALTIME with timer_create() on Cygwin. * Don't include winsock headers on Cygwin. Instead include for htons() and htonl(). * Handle AI_ADDRCONFIG not being defined by some mingw versions. * Fix to handle mingw now providing a nanosleep() function. * Use WSAAddressToString instead of inet_ntop under __WIN32__ - at least under mingw we don't seem to have inet_ntop(). * Fix testsuite to compile when S_ISSOCK() isn't defined. debug code: * Add missing parameters to debug logging for a few methods. Xapian-core 1.3.3 (2015-06-01): This release includes all changes from 1.2.20-1.2.21 which are relevant. API: * Database: + Add new flag Xapian::DB_RETRY_LOCK which allows opening a database for writing to wait until it can get a write lock. (Fixes #275, reported by Richard Boulton). + Fix Database::get_doclength_lower_bound() over multiple databases when some are empty or consist only of zero-length documents. Previously this would report a lower bound of zero, now it reports the same lowest bound as a single database containing all the same documents. + Database::check(): When checking a single table, handle the ".glass" extension on glass database tables, and use the extension to guide the decision of which backend the table is from. * Query: + Add new OP_WILDCARD query operator, which expands wildcards lazily, so now we create the PostList tree for a wildcard directly, rather than creating an intermediate Query tree. OP_WILDCARD offers a choice of ways to limit wildcard expansion (no limit, throw an exception, use the first N by term name, or use the most frequent N). (See tickets #48 and #608). * QueryParser: + Add new set_max_expansion() method which provides access to OP_WILDCARD's choice of ways to limit expansion and can set limits for partial terms as well as for wildcards. Partial terms now default to the 100 most frequent matching terms. (Completes #608, reported by boomboo). + Deprecate set_max_wildcard_expansion() in favour of set_max_expansion(). * Add support for optional reference counting of FieldProcessor and ValueRangeProcessor objects. testsuite: * If command line option --verbose/-v isn't specified, set the verbosity level from environmental variable VERBOSE. * Re-enable replicate3 for glass, as it no longer fails. * Add more test coverage for get_unique_terms(). * Don't leave an extra fd open when starting xapian-tcpsrv for remotetcp tests. glass backend: * When reporting freelist errors during a database check, distinguish between a block in use and in the freelist, and a block in the freelist more than once. * Fix compaction and database checking for the change to the format of keys in the positionlist table which happened in 1.3.2. * After splitting a block, we always insert the new block in the parent right after the block it was split from - there's no need to binary chop. * Avoid infinite recursion when we hit the end of the freelist block we're reading and the end of the block we're writing at the same time. * Fix freelist handling to allow for the newly loaded first block of the freelist being already used up. chert backend: * Fix problems with get_unique_terms() on a modified chert database. * Fix xapian-check on a single chert table, which seg faulted in 1.3.2. remote backend: * Avoid dividing zero by zero when calculating the average length for an empty database. build system: * Merge generate-allsnowballheaders script into collate-sbl. portability: * A compiler with good support for C++11 is now required to build Xapian. Most of the actively developed C++ compilers already have decent support, or are close to having it, and it makes development easier and more efficient. Currently known to work: GCC >= 4.7, recent versions of clang (3.5 works). Solaris Studio 12.4 compiles the code, but tests currently fail. IBM's xlC doesn't support enough of C++11 yet. HP's aCC hasn't been tested, but its documentation suggests it also doesn't support enough of C++11 yet. * Drop workarounds and special cases for old versions of various compilers which don't support C++11. * Use C++11's static_assert() and unique_ptr instead of custom implementations of equivalent functionality. * Building on OS/2 with EMX is no longer supported - EMX was last updated in 2001 and comes with GCC 3.2.1, which is much too old to support C++11. * Building with SGI's and Compaq's C++ compilers is no longer supported - both seem to have ceased development, and don't support C++11. * Building with STLport is no longer supported - STLport was last released in 2008, so it's no longer actively developed and won't support C++11. * Building on IRIX is no longer supported, because IRIX has reached end of life. * Disable " is expected to return a value" warning from Sun's C++ compiler, as it fires for functions which end in a "throw" statement. Genuine instances of missing return values will be caught by compilers with superior warning machinery. * Fix warning from GCC 5.1 where template expansion leads to the comparison (bool_value < 255) which is always true. Warning introduced by changes in 1.3.2. * Use getaddrinfo() instead of gethostbyname(), since the latter may not be thread-safe, and as a step towards IPv6 support (see #374), but currently we still only look for IPv4 addresses. * timer_create() seems to always fail on AIX with EAGAIN, so just skip the matchtimelimit1 testcase there. * Under __WIN32__, we need to specify Vista as the minimum supported version to get the AI_ADDRCONFIG flag. Older versions seem to all be out of support anyway. * Change configure probe for log2() to check for a declaration in to get it to fix build on Solaris with Sun C++. C++11 compilers should all provide log2(), but let's not rely on that just yet as it's easy to provide a fallback implementation. * Use scalbn() instead of ldexp() where possible (which we can in all cases when FLT_RADIX == 2, as it is on pretty much all current platforms). On overflow and underflow ldexp() sets errno, which it seems better to avoid doing. * The list of stemmers is now in the same static const struct as the version info, and Stem::get_available_languages() is just an inlined wrapper which fetches this structure and returns the appropriate member. This saves a relocation, reducing library load time a little. * Remove "pure" attribute from API functions which could throw an exception. These functions aren't really pure, and while we're happy for calls to them to be CSE-ed or eliminated entirely, the compiler might make more assumptions than that about a pure function - clang seems to assume pure => nothrow and an exception from such a function can't be caught. * Remove "pure" attribute from sortable_unserialise(), which can raise floating point exceptions FE_OVERFLOW and FE_UNDERFLOW. * Add "nothrow" attribute to more API functions which will never throw an exception. * Make sortable_serialise() an inlined wrapper around a function which won't throw and can be flagged with attribute 'const'. * Tweak sortable_unserialise() not to compare with a fixed string by constructing a temporary std::string object (which could throw std::bad_alloc), and mark it as XAPIAN_NOTHROW. debug code: * Only enable assertions in sortable_serialise() and sortable_unserialise() in the testsuite (since these functions shouldn't throw exceptions), and move the tests of these functions from queryparsertest to unittest to facilitate this. * Add more assertions to the glass backend code. Xapian-core 1.3.2 (2014-11-24): This release includes all changes from 1.2.16-1.2.19 which are relevant. API: * Update Unicode character database to Unicode 7.0.0. * New Xapian::Snipper class from Mihai Bivol's GSOC 2012 project. (mostly fixes #211) * Fix all get_description() methods to always return UTF-8 text. (fixes #620) * Database::check(): + Alter to take its "out" parameter as a pointer to std::ostream instead of a reference, and make passing NULL mean "do not produce output", and make the second and third parameters optional, defaulting to a quiet check. + Escape invalid UTF-8 data in keys and tags reported by xapian-check, using the same code we use to clean up strings returned by get_description() methods. + Correct failure message which talks above the root block when it's actually testing a leaf key. + Rename DBCHECK_SHOW_BITMAP to DBCHECK_SHOW_FREELIST (old name still provided for now, but flagged as deprecated - DBCHECK_SHOW_BITMAP was new in 1.3.0, so will likely be removed before 1.4.0). * Methods and functions which take a string to unserialise now consistently call that parameter "serialised". * Weight: Make number of distinct terms indexing each document and the collection frequency of the term available to subclasses. Patch from Gaurav Arora's Language Modelling branch. * WritableDatabase: Add support for multiple subdatabases, and support opening a stub database containing multiple subdatabases as a WritableDatabase. * WritableDatabase can now be constructed from just a pathname (defaulting to opening the database with DB_CREATE_OR_OPEN). * WritableDatabase: Add flags which can be bitwise OR-ed into the second argument when constructing: + Xapian::DB_NO_SYNC: to disable use of fsync, etc + Xapian::DB_DANGEROUS: to enable in-place updates + Xapian::DB_BACKEND_CHERT: if creating, create a chert database + Xapian::DB_BACKEND_GLASS: if creating, create a glass database + Xapian::DB_NO_TERMLIST: create a database without a termlist (see #181) + Xapian::DB_FULL_SYNC flag - if this is set for a database, we use the Mac OS X F_FULL_SYNC instead of fdatasync()/fsync()/etc on the version file when committing. * Database: Add optional flags argument to constructor - the following can be bitwise OR-ed into it: + Xapian::DB_BACKEND_CHERT (only open a chert database) + Xapian::DB_BACKEND_GLASS (only open a glass database) + Xapian::DB_BACKEND_STUB (only open a stub database) * Xapian::Auto::open_stub() and Xapian::Chert::open() are now deprecated in favour of these new flags. * Add LMWeight class, which implements the Unigram Language Modelling weighting scheme. Patch from Gaurav Arora. * Add implementations of a number of DfR weighting schemes (BB2, DLH, DPH, IfB2, IneB2, InL2, PL2). Patches from Aarsh Shah. * Add support for the Bo1 query expansion scheme. Patch from Aarsh Shah. * Add Enquire::set_time_limit() method which sets a timelimit after which check_at_least will be disabled. * Database: Trying to perform operations on a database with no subdatabases now throws InvalidOperationError not DocNotFoundError. * Query: Implement new OP_MAX query operator, which returns the maximum weight of any of its subqueries. (see #360) * Query: Add methods to allow introspection on Query objects - currently you can read the leaf type/operator, how many subqueries there are, and get a particular subquery. For a query which is a term, Query::get_terms_begin() allows you to get the term. (see #159) * Query: Only simplify OP_SYNONYM with a single subquery if that subquery is a term or MatchAll. * Avoid two vector copies when storing term positions in most common cases. * Reimplement version functions to use a single function in libxapian which returns a pointer to a static const struct containing the version information, with inline wrappers in the API header which call this. This means we only need one relocation instead of 4, reducing library load time a little. * Make TermGenerator flags an anonymous enum, and typedef TermGenerator::flags to int for backward compatibility with existing user code which uses it. * Stem: Fix incorrect Unicode codepoints for o-double-acute and u-double-acute in the Hungarian Snowball stemmer. Reported by Tom Lane to snowball-discuss. * Stem: Add an early english stemmer. * Provide the stopword lists from Snowball plus an Arabic one, installed in ${prefix}/share/xapian-core/stopwords/. Patch from Assem Chelli, fixes #269. * Improve check for direct inclusion of Xapian subheaders in user code to catch more cases. * Add simple API to help with creating language-idiomatic iterator wrappers in . testsuite: * Extend checkstatsweight1 to check that Weight::get_collection_freq() returns the same number as Database::get_collection_freq(). * queryparsertest: Add testcase for FieldProcessor on boolean prefix with quoted contents. * queryparsertest: Enable some disabled cases which actually work (in some cases with slightly tweaked expected answers which are equivalent to those that were shown). * Make use of the new writable multidatabase feature to simplify the multi-database handling in the test harness. * Change querypairwise1_helper to repeat the query build 100 times, as with a fast modern machine we were sometimes trying with so many subqueries that we would run out of stack. * apitest: Use Xapian::Database::check() in cursordelbug1. (partly addresses #238) * apitest: Test Query ops with a single MatchAll subquery. * apitest: New testcase readonlyparentdir1 to ensure that commit works with a read-only parent directory. matcher: * Streamline collation of statistics for use by weighting schemes - tests show a 2% or so increase in speed in some cases. * If a term matches all documents and its weight doesn't depend on its wdf, we can optimise it to MatchAll (the previous requirement that maxpart == 0 was unnecessarily strict). * Fix the check for a term which matches all documents to use the sub-db termfreq, not the combined db termfreq. * When we optimise a postlist for a term which matches all documents to use MatchAll, we still need to set a weight object on it to get percentages calculated correctly. glass backend: * 'brass' backend renamed to 'glass' - we decided to use names in ascending alphabetical order to make it easier to understand which backend is newest, and since 'flint' was used recently, we skipped over 'd', 'e' and 'f'. * Change positionlist keys to be ordered by term first rather than docid first, which helps phrase searching significantly. For more efficient indexing, positionlist changes are now batched up in memory and written out in key order. * Use a separate cursor for each position list - now we're ordering the position B-tree by term first, phrase matching would cause a single cursor to cycle between disparate areas of the B-tree and reread the same blocks repeatedly. * Reference count blocks in the btree cursor, so cursors can cheaply share blocks. This can significantly reduce the amount of memory used by cursors for queries which contain a lot of terms (e.g. wildcards which expand to a lot of terms). * Under glass, optimise the turning of a query into a postlist to reuse the cursor blocks which are the same as the previous term's postlist. This is particularly effective for a wildcard query which expands to a lot of terms. * Keep track of unused blocks in the Btrees using freelists rather than bitmaps. (fixes #40) * Eliminate the base files, and instead store the root block and freelist pointers in the "iamglass" file. * When compacting, sync all the tables together at the end. * In DB_DANGEROUS mode, update the version file in-place. * Only actually store the document data if it is non-empty. The table which holds the document data is now lazily created, so won't exist if you never set the document data. chert backend: * Improve DBCHECK_FIX: + if fixing a whole database, we now take the revision from the first table we successfully look at, which should be correct in most cases, and is definitely better than trying to determine the revision of each broken table independently. + handle a zero-sized .DB file. + After we successfully regenerate baseA, remove any empty baseB file to prevent it causing problems. Tracked down with help from Phil Hands. remote backend: * Bump remote protocol version to 38.0, due to extra statistics being tracked for weighting. * Make Weight::Internal track if any max_part values are set, so we don't need to serialise them when they've not been set. build system: * Fix conditional for enabling replication code - if chert is disabled but glass isn't, we should still enable it. * configure: Add hint for which package to install for rst2html documentation: * Don't build, ship or install PDF versions of the API docs by default, but provide an easy way for people to build it for themselves if they want it. * Convert equations in rst docs to use LaTeX via the math role and directive. * Actually ship, process and install geospatial.rst. * postingsource.rst: Use a modern class in postingsource example. (Noted by James Aylett) * Move the protocol docs for the remote and replication protocols into the net/ subdirectory. * Remove the dir_contents files and all the machinery to handle them. * HACKING: Note we now use doxygen 1.8.8 for 1.3.x snapshots and releases. * HACKING: Now using libtool 2.4.3 to bootstrap snapshots and 1.3.x releases. * HACKING: Now using automake 1.14.1 to bootstrap snapshots and 1.3.x releases. * HACKING: Drop note about needing git-svn if you're using git - bootstrap now only uses git-svn if your Xapian tree was checked out using git-svn. * HACKING: Need sphinx-doc to generate API docs for Python and Python 3 bindings. * HACKING: Note that MacTeX seems to be the best option if using homebrew. portability: * Don't pass an integer argument to log(), to avoid ambiguity errors with xlC and Sun's C++ compiler. (fixes #627) * Fix compilations issues with Sun's C++ compiler (mostly missing library headers). * Implement RealTime::now() using clock_gettime() where it's available, since it can provide nanosecond resolution. * Implement RealTime::sleep() using nanosleep() where it's available, since it has a simpler API and a finer resolution than select(). * Use lround() instead of round() in geospatial code, since we want the result as an int. GCC 4.4.3 seems to optimise to use lround() anyway, but other compilers may not. * Include for lround()/round(). (fixes #628) * Drop code supporting Microsoft Windows 9x which reached EOL in 2006. * Under C++11, use unique_ptr for AutoPtr. * Stop using a reference where we may end up passing *NULL, as that's invalid. Thanks Nick Lewycky and ubsan for helping track this down. * In DLHWeight and DPHWeight, avoid dividing by zero when the collection size is 0. debug code: * Fix assertion failure when built with --enable-assertions. The behaviour when built without assertions happened to be correct. * Fix assertion in BitReader::decode(), and remove 'Assert(rd);' in two places where rd is no longer a pointer. Xapian-core 1.3.1 (2013-05-03): This release includes all changes from 1.2.10-1.2.15 which are relevant. API: * Give an compilation error if user code tries to include API headers other than xapian.h directly - these other headers are an internal implementation detail, but experience has shown that some people try to include them directly. Please just use '#include ' instead. * Update Unicode character database to Unicode 6.2.0. * Add FieldProcessor class (ticket#128) - currently marked as an experimental API while we sort out how best to sort out exactly how it interacts with other QueryParser features. * Add implementation of several TF-IDF weighting schemes via a new TfIdfWeight class. * Add ExpandDeciderFilterPrefix class which only return terms with a particular prefix. (fixes #467) * QueryParser: Adjust handling of Unicode opening/closing double quotes - if a quoted boolean term was started with ASCII double quote, then only ASCII double quote can end it, as otherwise it's impossible to quote a term containing Unicode double quotes. * Database::check(): If the database can't be opened, don't emit a bogus warning about there being too many documents to cross-check doclens. * TradWeight,BM25Weight: Throw SerialisationError instead of NetworkError if unserialise() fails. * QueryParser: Change the default stemming strategy to STEM_SOME, to eliminate the API gotcha that setting a stemmer is ignored until you also set a strategy. * Deprecate Xapian::ErrorHandler. (ticket#3) * Stem: Generate a compact and efficient table to decode language names. This is both faster and smaller than the approach we were using, with the added benefit that the table is auto-generated. * xapian.h: + Add check for Qt headers being included before us and defining 'slots' as a macro - if they are, give a clear error advising how to work around this (previously compilation would fail with a confusing error). + Add a similar check for Wt headers which also define 'slots' as a macro by default. testsuite: * tests/generate-api_generated: Test that the string returned by a get_description() method isn't empty. * Use git commit hash in title of test coverage reports generated from a git tree. matcher: * Drop MatchNothing subqueries in OR-like situations in add_subquery() rather than adding them and then handling it later. * Handle the left side of AND_NOT and AND_MAYBE being MatchNothing in add_subquery() rather than in done(). * Handle QueryAndLike with a MatchNothing subquery in add_subquery() rather than done(). * Query: Multi-way operators now store their subquery pointers in a custom class rather than std::vector. The custom class take the same amount of space, or often less. It's particularly efficient when there are two subqueries, which is very desirable as we no longer flatten a subtree of the same operator as we build the query. * Optimise an unweighted query term which matches all the documents in a subdatabase to use the "MatchAll" postlist. (ticket#387) brass backend: * Iterating positional data now decodes it lazily, which should speed up phrases which include common words. * Compress changesets in brass replication. Increments the changeset version. Ticket #348 * Restore two missing lines in database checking where we report a block with the wrong level. * When checking if a block was newly allocated in this revision, just look at its revision number rather than consulting the base file's bitmap. chert backend: * Iterating positional data now decodes it lazily, which should speed up phrases which include common words. remote backend: * Prefix compress list of terms and metadata keys in the remote protocol. This requires a remote protocol major version bump. build system: * Fix the 'libxapian' to be 'libxapian-1.3' and 'xapian.m4' to be 'xapian-1.3.m4' (this was supposed to be the case for 1.3.0, but the change wasn't made correctly). * Remove support for 'configure --enable-quiet', 'make QUIET=' and 'make QUIET=y' - automake now supports 'configure --enable-silent-rules', 'make V=1' and 'make V=0' which are broadly equivalent and more standard. * configure: If we fail to find a function needed for the remote backend, don't autodisable it - it's more helpful to error out so the use can decide if they want to pass --disable-backend-remote to disable it, or work out what values to pass for LIBS, etc to make it work. This also matches what we do for the disk based backends. * automake 1.13.1 is now used to generate snapshots and releases. * Add check-syntax make target to support editor syntax checks. * Fix to build when configured with --disable-backend-brass --disable-backend-chert. (ticket#586) * Generate a check for compatible _DEBUG settings if built with MSVC. (ticket#389) * If you run "make coverage-check" by hand, the previous default of compressed HTML is unhelpful, so don't default to passing --html-gzip to genhtml, but instead add support for GENHTML_ARGS. * API methods and functions are now marked as 'const', 'pure', or 'nothrow' allowing compilers which support such annotations to generate more efficient code. (tickets #151, #454) documentation: * HACKING: Note which MacPorts are needed for development work. * docs/remote_protocol.rst: Correct error in documentation of REPLY_DOCDATA message. tools: * xapian-check: Add "fix" option, which currently will regenerate iamchert if it isn't valid, and will regenerate base files from the .DB files (only really tested on databases which have just been compacted). portability: * Fix warning with GCC in build with assertions enabled. * common/fileutils.cc: Add safeunistd.h for mkdir, required by GCC 4.7 (reported by Gaurav Arora). * backends/brass/brass_databasereplicator.cc: Use new/delete to avoid variable length array gcc extension and comply with c++98 * Mark file descriptors as close-on-exec where supported. * api/queryinternal.cc: Need for mem_fun(). * Work around Apple's OS X SDK defining a check() macro. * Add an option to use a flock() based locking implementation for brass and chert - this is much simpler than using fcntl() due to saner semantics around releasing locks when closing other descriptors on the same file (at least on platforms where flock() isn't just a compatibility wrapper around fcntl()). Sadly we can't simply switch to this without breaking locking compatibility with previous releases, but it's useful for platforms without fcntl() locking (it's enabled for DJGPP) and may be useful for custom builds for special purposes. packaging: * xapian-core.spec: Remove xapian-chert-update. debug code: * Building with --enable-log works once again. Xapian-core 1.3.0 (2012-03-14): API: * Update Unicode character database to Unicode 6.1.0. (ticket#497) * TermIterator returned by Enquire::get_matching_terms_begin(), Query::get_terms_begin(), Database::synonyms_begin(), QueryParser::stoplist_begin(), and QueryParser::unstem_begin() now stores the list of terms to iterate much more compactly. * QueryParser: + Allow Unicode curly double quote characters to start and/or end phrases. + The set_default_op() method will now reject operators which don't make sense to set. The operators which are allowed are now explicitly documented in the API docs. * Query: The internals have been completely reimplemented (ticket#280). The notable changes are: + Query objects are smaller and should be faster. + More readable format for Query::get_description(). + More compact serialisation format for Query objects. + Query operators are no longer flattened as you build up a tree (but the query optimiser still combines groups of the same operator). This means that Query objects are truly immutable, and so we don't need to copy Query objects when composing them. This should also fix a few O(n*n) cases when building up an n-way query pair-wise. (ticket#273) + The Query optimiser can do a few extra optimisations. * There's now explicit support for geospatial search (this API is currently marked as experimental). (ticket#481) * There's now an API (currently experimental) for checking the integrity of databases (partly addresses ticket#238). * Database::reopen() now returns true if the database may have been reopened (previously it returned void). (ticket#548) * Deprecate Xapian::timeout in favour of POSIX type useconds_t. * Deprecate Xapian::percent and use int instead in the API and our own code. * Deprecate Xapian::weight typedef in favour of just using double and change all uses in the API and our own code. (ticket#560) * Rearrange members of Xapian::Error to reduce its size (from 48 to 40 bytes on x86-64 Linux). * Assignment operators for PositionIterator and TermIterator now return *this rather than void. * PositionIterator, PostingIterator, TermIterator and ValueIterator now handle their reference counts in hand-crafted code rather than using intrusive_ptr/RefCntPtr, which means the compiler can inline the destructor and default constructor, so a comparison to an end iterator should now optimise to a simple NULL pointer check, but without the issues which the ValueIteratorEnd_ proxy class approach had (such as not working in templates or some cases of overload resolution). * Enquire: + Previously, Enquire::get_matching_terms_begin() threw InvalidArgumentError if the query was empty. Now we just return an end iterator, which is more consistent with how empty queries behave elsewhere. + Remove the deprecated old-style match spy approach of using a MatchDecider. * Remove deprecated Sorter class and MultiValueSorter subclass. * Xapian::Stem: + Add stemmers for Armenian (hy), Basque (eu), and Catalan (ca). + Stem::operator= now returns a reference to the assigned-to object. testsuite: * Make unittest use the test harness, so it gets all the valgrind and fd leak checks, and other handy features all the other tests have. * Improve test coverage in several places. * Compress generated HTML files in coverage report. flint backend: * Remove flint backend. remote backend: * When propagating exceptions from a remote backend server, the protocol now sends a numeric code to represent which exception is being propagated, rather than the name of the type, as a number can be turned back into an exception with a simple switch statement and is also less data to transfer. (ticket#471) * Remote protocol (these changes require a protocol major version bump): + Unify REPLY_GREETING and REPLY_UPDATE. + Send (last_docid - doccount) instead of last_docid and (doclen_ubound - doclen_lbound) instead of doclen_ubound. * Remove special check which gives a more helpful error message when a modern client is used against a remote server running Xapian <= 0.9.6. build system: * Various changes allow us to now remove XAPIAN_VISIBILITY_DEFAULT from a number of functions which aren't in the public API (partly addresses ticket#63). * configure: For this development series, the library gets a -1.3 suffix and include files are installed with an extra /xapian-1.3 component to make parallel installs easier. * configure: Enable -fshow-column for GCC - things like vim's quickfix mode will then jump to the appropriate column for a compiler error or warning, not just the appropriate line. * Snowball compiler now reports "FILE:LINE:" before each error so tools like vim's quickfix mode can parse this and bring up the line with the error automatically. * docs/doxygen_api.conf.in: Don't generate XML from doxygen for the bindings - the bindings now do this for themselves. (ticket#262) documentation: * INSTALL: Update GCC details - we now recommend 4.3 or newer (was 4.1), and note that while 3.1 is the hard minimum requirement, the oldest we've tested with at all recently was 3.3. * docs/deprecation.rst: Updated. tools: * delve: + Move delve from examples to bin and rename to xapian-delve. + Send errors to stderr not stdout. * xapian-check: Now reports useful descriptions rather than cryptic numeric codes for B-tree errors. debug code: * Add assertions that the index is in range when dereferencing MSetIterator and ESetIterator. * Fix various errors in debug logging statements. * Add QUERY category for debug logging. Xapian-core 1.2.23 (2016-03-28): API: * PostingSource: Public member variables are now wrapped by methods (mostly getters and/or setters, depending on whether they should be readable, writable or both). In 1.3.5, the public members variables have been deprecated - we've added the replacement methods in 1.2.23 as well to make it easier for people to migrate over. chert backend: * xapian-check now performs additional consistency checks for chert. Reported by Jean-Francois Dockes and Bob Cargill via xapian-discuss. documentation: * Update links to Xapian website and trac to use https, which is now supported, thanks to James Aylett. portability: * On older Linux kernels, rename() of a file within a directory on NFS can sometimes erroneously fail with EXDEV. This should only happen if you try to rename a file across filing systems, so workaround this issue by retrying up to 5 times on EXDEV (which should be plenty to avoid this bug, and we don't want to risk looping forever). Fixes #698, reported by Mark Dufour. Xapian-core 1.2.22 (2015-12-29): API: * Add FLAG_CJK_NGRAM for QueryParser and TermGenerator. Has the same effect as setting the environment variable XAPIAN_CJK_NGRAM. Fixes #180, reported by Richard Boulton, with contributions from Pavel Strashkin, Mikkel Kamstrup Erlandsen and Brandon Schaefer. * Fix bug parsing multiple non-exclusive filter terms - previously this could result in such filters effectively being ignored. * Fix Database::get_doclength_lower_bound() over multiple databases when some are empty or consist only of zero-length documents. Previously this would report a lower bound of zero, now it reports the same lowest bound as a single database containing all the same documents. * Make Database::get_wdf_upper_bound("") return 0. * Mark constructors taking a single argument as "explicit" to avoid unwanted implicit conversions. testsuite: * If command line option --verbose/-v isn't specified, set the verbosity level from environmental variable VERBOSE. * Skip timed tests if $AUTOMATED_TESTING is set. Fixes #553, reported by Dagobert Michelsen. * Don't leave an extra fd open when starting xapian-tcpsrv for remotetcp tests. * apitest: Revert disabling of part of adddoc5 for clang - the test failure was in fact due to a bug in 1.3.x, and 1.2.x was never affected. * apitest: Tweak bounds checks in dbstats1 testcase - multi backends should give tight bounds. brass backend: * Format limit on docid now correctly imposed when sizeof(int) > 4. * Avoid potential DB corruption with full-compaction when using 64K blocks. chert backend: * Format limit on docid now correctly imposed when sizeof(int) > 4. * Avoid potential DB corruption with full-compaction when using 64K blocks. flint backend: * Format limit on docid now correctly imposed when sizeof(int) > 4. * Avoid potential DB corruption with full-compaction when using 64K blocks. remote backend: * Fix to handle total document length exceeding 34,359,738,368. (Fixes #678, reported by matf). * Avoid dividing by zero when getting the average length for an empty database. * Stop apparent error from remote server when read-only client disconnects. A read-only client just closes the connection when done, but the server previously reported "Got exception NetworkError: Received EOF", which sounds like there was a problem. Now we just say "Connection closed" here, and "Connection closed unexpectedly" if the client connects in the middle of an exchange. Possibly fixes #654, reported by Germán M. Bravo. * Give a clearer error message when the client and server remote protocol versions aren't compatible. * Check length of key in MSG_SETMETADATA. build system: * pkg-config: Fix library name in .pc file to say "xapian" not "xapian-core". Reported by Eric Lindblad to the xapian-devel list. * Private symbol decode_length() is no longer visible outside the library. documentation: * Stop maintaining ChangeLog files. They make merging patches harder, and stop 'git cherry-pick' from working as it should. The git repo history should be sufficient for complying with GPLv2 2(a). * Strip out "quickstart" examples which are out of date and rather redundant with the "simple" examples. * Correct documentation of Enquire::get_query(). If no query has been set, the documentation said Xapian::InvalidArgumentError was thrown, but in fact we just return a default initialised Query object (i.e. Query()). This seems reasonable behaviour and has been the case since Xapian 0.9.0. * Document xapian-compact --blocksize takes an argument. * Update snowball website link to snowballstem.org. tools: * xapian-replicate: Fix replication for files > 4GB on 32-bit platforms. Previously replication would fail to copy a file whose size didn't fit in size_t. Fixes #685, reported by Josh Elsasser. * xapian-tcpsrv: Better error if -p/--port not specified * quest: Support `-f cjk_ngram`. examples: * xapian-metadata: Extend "list" subcommand to take optional key prefix. portability: * Fix new warnings from recent versions of GCC and clang. * Add spaces between literal strings and macros which expand to literal strings for C++11 compatibility in __WIN32__-specific code. * Need for unlink() on FreeBSD, reported by Germán M. Bravo via github PR 72. * Fix testsuite to build when S_ISSOCK() isn't defined. * Don't provide our own implementation of sleep() under __WIN32__ if there already is one - mingw provides one, and in some situations it seems to clash with ours. Reported to xapian-discuss by John Alveris. * Add missing '#include ' to htons(). Seems to be implicitly included on most platforms, but Interix needs it. Reported by Eric Lindblad on xapian-discuss. * Disable " is expected to return a value" warning from Sun's C++ compiler, as it fires for functions ending in a "throw" statement. Genuine instances will be caught by compilers with superior warning machinery. * Prefer scalbn() to ldexp() where possible, since the former doesn't ever set errno. * '#include ' in the "simple" examples, as when compiling with xlC on AIX, _LARGE_FILES gets defined by AC_SYS_LARGEFILE to enable large file support, and defining this changes the ABI of std::string, so it also needs to be defined when compiling code using Xapian. * On cygwin, include instead of winsock headers for htons() and htonl(). * Include for CYGWIN_VERSION_API_MAJOR. * Avoid referencing static members via an object in that object's own definition, as this doesn't work with all compilers (noted with GCC 3.3), and is a bit of an odd construct anyway. Reported by Eric Lindblad on xapian-discuss. * GCC < 3.4.2 lacks operator<< overloads for unsigned long long on some platforms, so simply work around this by using str(), as this isn't performance sensitive code. Reported by Eric Lindblad on xapian-discuss. * Fix delete which should be delete[] in brass backend cursor code. Xapian-core 1.2.21 (2015-05-20): API: * QueryParser: Extend the set of characters allowed in the start of a range to be anything except for '(' and characters <= ' '. This better matches what's accepted for a range end (anything except for ')' and characters <= ' '). Reported by Jani Nikula. matcher: * Reimplement OP_PHRASE for non-exact phrases. The previous implementation was buggy, giving both false positives and false negatives in rare cases when three or more terms were involved. Fixes #653, reported by Jean-Francois Dockes. * Reimplement OP_NEAR - the new implementation consistently requires the terms to occur at different positions, and fixes some previously missed matches. * Fix a reversed check for picking the shorter position list for an exact phrase of two terms. The difference this makes isn't dramatic, but can be measured (at least with cachegrind). Thanks to kbwt for spotting this. * When matching an exact phrase, if a term doesn't occur where we want, use its actual position to advance the anchor term, rather than just checking the next position of the anchor term. brass backend: * Fix cursor versioning to consider cancel() and reopen() as events where the cursor version may need incrementing, and flag the current cursor version as used when a cursor is rebuilt. Fixes #675, reported by Germán M. Bravo. * Avoid using file descriptions < 3 for writable database tables, as it risks corruption if some code in the same process tries to write to stdout or stderr without realising it is closed. (Partly addresses #651) chert backend: * Fix cursor versioning to consider cancel() and reopen() as events where the cursor version may need incrementing, and flag the current cursor version as used when a cursor is rebuilt. Fixes #675, reported by Germán M. Bravo. * Avoid using file descriptions < 3 for writable database tables, as it risks corruption if some code in the same process tries to write to stdout or stderr without realising it is closed. (Partly addresses #651) flint backend: * Fix cursor versioning to consider cancel() and reopen() as events where the cursor version may need incrementing, and flag the current cursor version as used when a cursor is rebuilt. Fixes #675, reported by Germán M. Bravo. remote backend: * Fix sort by value when multiple databases are in use and one or more are remote. This change necessitated a minor version bump in the remote protocol. Fixes #674, reported by Dylan Griffith. If you are upgrading a live system which uses the remote backend, upgrade the servers before the clients. build system: * The compiler ABI check in the public API headers now issues a warning (instead of an error) for an ABI mismatch for ABI versions 2 and later (which means GCC >= 3.4). The changes in these ABI versions are bug fixes for corner cases, so there's a good chance of things working - e.g. building xapian-bindings with GCC 5.1 (which defaults to ABI version 8) against xapian-core built with GCC 4.9 (which defaults to ABI version 2) seems to work OK. A warning is still useful as a clue to what is going on if linking fails due to a missing symbol. * xapian-config,xapian-core.pc: When compiling with xlC on AIX, the reported --cxxflags/--cflags now include -D_LARGE_FILES=1 as this is defined for the library, and defining it changes the ABI of std::string with this compiler, so it must also be defined when building code using the Xapian API. * xapian-core.pc: Include --enable-runtime-pseudo-reloc in --libs output for mingw and cygwin, like xapian-config does. * xapian-core.pc: Fix include directory reported by `pkg-config --cflags`. This bug was harmless if xapian-core was installed to a directory which was on the default header search path (such as /usr/include). * xapian-config: Fix typo so cached result of test in is_uninstalled() is actually used on subsequent calls. Fixes #676, reported (with patch) by Ryan Schmidt. * configure: Changes in 1.2.19 broke the custom macro we use to probe for supported compiler flags such that the flags never got used. This release fixes this problem. * configure: Set default value for AUTOM4TE before AC_OUTPUT so the default will actually get used. Only relevant when building in maintainer mode (e.g. from git). * soaktest: Link with libtool's '-no-install' or '-no-fast-install', like we already do for other test programs, which means that libtool doesn't need to generate shell script wrappers for them on most platforms. documentation: * API documentation: Minor wording tweaks and formatting improvements. * docs/deprecation.rst: Add deprecation of omindex --preserve-nonduplicates which happened in 1.2.4. * HACKING: Update URL. * HACKING: libtool 2.4.6 is now used for bootstrapping snapshots and releases. tools: * xapian-compact: Make sure we open all the tables of input databases at the same revision. (Fixes #649) * xapian-metadata: Add 'list' subcommand to list all the metadata keys. * xapian-replicate: Fix connection timeout to be 10 seconds rather than 10000 seconds (the incorrect timeout has been the case since 1.2.3). * xapian-replicate: Set SO_KEEPALIVE for xapian-replicate's connection to the master, and add command line option to allow setting socket-level timeouts (SO_RCVTIMEO and SO_SNDTIMEO) on platforms that support them. Fixes #546, reported by nkvoll. * xapian-replicate-server: Avoid potentially reading uninitialised data if a changeset file is truncated. portability: * Add spaces between literal strings and macros which expand to literal strings for C++11 compatibility. * ValueCountMatchSpy::top_values_begin(): Fix the comparison function not to return true for two equal elements, which manifests as incorrect sorting in some cases when using clang's libc++ (which recent OS X versions do). * apitest: The adddoc5 testcase fails under clang due to an exception handling bug, so just #ifdef out the problematic part of the testcase when building with clang for now. * Fix clang warnings on OS X. Reported by Germán M. Bravo. * Fix examples to build with IBM's xlC compiler on AIX - they were failing due to _LARGE_FILES being defined for the library build but not for the examples, and defining this changes the ABI of std::string with this compiler. * configure: Improve the probe for whether the test harness can use RTTI to work for IBM's xlC compiler (which defaults to not generating RTTI). * Fix to build with Sun's C++ compiler. * Use F_DUPFD where available to dup to a file descriptor which is >= 2, rather than calling dup() until we get one. * When unserialising a double, avoid reading one byte past the end of the serialised value. In practice this was harmless on most platforms, as dbl_max_mantissa is 255 for IEEE-754 format doubles, and at least GCC's std::string keeps the buffer nul-terminated. Reported by Germán M. Bravo in github PR#67. * When unserialising a double, add missing cast to unsigned char when we check if the value will fit in the double type. On machines with IEEE-754 doubles (which is most current platforms) this happened to work OK before. It would also have been fine on machines where char is unsigned by default. * Fix incorrect use of "delete" which should be "delete []". This is undefined behaviour in C++, though the type is POD, so in practice this probably worked OK on many platforms. debug code: * Fix some overly strict assertions in flint, which caused apitest's cursordelbug1 to fail with assertions on. Xapian-core 1.2.20 (2015-03-04): chert backend: * After splitting a block, we always insert the new block in the parent right after the block it was split from - there's no need to binary chop. build system: * Generate and install a file for pkg-config. (Fixes#540) * configure: Update link to cygwin FAQ in error message. documentation: * include/xapian/weight.h: Document the enum stat_flags values. * docs/postingsource.rst: Use a modern class in postingsource example. (Noted by James Aylett) * docs/deprecation.rst,docs/replication.rst: Fix typos. * Update doxygen configuration files to avoid warnings about obsolete tags from newer doxygen versions. * HACKING: Update details of building Xapian packages. tools: * xapian-check: For chert and brass, cross-check the position and postlist tables to detect positional data for non-existent documents. portability: * When locking a database for writing, use F_OFD_SETLK where available, which avoids having to fork() a child process to hold the lock. This currently requires Linux kernel >= 3.15, but it has been submitted to POSIX so hopefully will be widely supported eventually. Thanks to Austin Clements for pointing out this now exists. * Fix detection of fdatasync(), which appears to have been broken practically forever - this means we've probably been using fsync() instead, which probably isn't a big additional overhead. Thanks to Vlad Shablinsky for helping with Mac OS X portability of this fix. * configure: Define MINGW_HAS_SECURE_API under mingw to get _putenv_s() declared in stdlib.h. * Use POSIX O_NONBLOCK in preference to O_NDELAY - the semantics of the latter differ between BSD and System V. * According to POSIX, strerror() may not be thread safe, so use alternative thread-safe ways to translate errno values where possible. * On Microsoft Windows, avoid defining EADDRINUSE, etc if they're already defined, and use WSAE* constants un-negated - they start from a high value so won't collide with E* constants. debug code: * Add more assertions to the chert backend code. Xapian-core 1.2.19 (2014-10-21): API: * Xapian::BM25Weight: + Improve BM25 upper bound in the case when our wdf upper bound > our document length lower bound. Thanks to Craig Macdonald for pointing out this trick. + Pre-multiply termweight by (param_k1 + 1) rather than doing it for every weighted term in every document considered. testsuite: * Don't report apparent leaks of fds opened on /dev/urandom - at least on Linux, something in the C library seems to lazily open it, and the report of a possible leak followed by assurance that it's OK really is just noise we can do without. matcher: * Fix false matches reported for non-exact phrases in some cases. Fixes the reduced testcase in #657, reported by Jean-Francois Dockes. brass backend: * Only full sync after writing the final base file (only affects Max OS X). chert backend: * Only full sync after writing the final base file (only affects Max OS X). flint backend: * Only full sync after writing the final base file (only affects Max OS X). build system: * For Sun's C++ compiler, pass -library=Crun separately since libtool looks for " -library=stlport4 " (with the spaces). (fixes#650) * Remove .replicatmp (created by the test suite) upon "make clean". documentation: * include/xapian/compactor.h: Fix formatting of doxygen comment. * HACKING: freecode no longer accepts updates, so drop that item from the release checklist. * docs/overview.rst: Add missing database path to example of using xapian-progsrv in a stub database file. portability: * Suppress unused typedef warnings from debugging logging macros, which occur in functions which always exit via throwing an exception when compiling with recent versions of GCC or clang. * Fix debug logging code to compile with clang. (fixes #657, reported by Germán M. Bravo) debug code: * Add missing RETURN() markup for debug logging in a few places, highlighted by warnings from recent GCC. * Fix incorrect return types in debug logging annotations so that code compiles when configured with --enable-log. Xapian-core 1.2.18 (2014-06-22): API: * Document: Fix get_docid() to return the docid for the sub-database (as it is explicitly documented to) for Document objects passed to functors like KeyMaker during the match. (fixes#636, reported by Jeff Rand). * Document: Don't store the termname in OmDocumentTerm - we were only using it in get_description() output and an exception message. Speeds up indexing etext.txt using simpleindex by 0.4%, and should reduce memory usage a bit too. (Change inspired by comments from Vishesh Handa on xapian-devel). * Database: Iterating the values in a particular slot is now a bit more efficient for inmemory and remote backends (but still slow compared to flint, chert and brass). testsuite: * apitest: Expand crashrecovery1 to check that the expected base files exist and ones which shouldn't exist don't. * queryparsertest: Fix testcase for empty wildcard followed by negation to enable FLAG_LOVEHATE so the negation is actually parsed. Fortunately the fixed testcase passes. matcher: * OP_SYNONYM: avoid fetching the doclength if the weighting scheme doesn't need it and the calculated wdf for the synonym is <= doclength_lower_bound for the current subdatabase. (fixes #360) build system: * Releases are now bootstrapped with libtool 2.4.2 instead of 2.4, and with config.guess and config.sub updated to the latest versions. documentation: * Add an example of initializing SimpleStopper using a file listing stopwords. (Patch from Assem Chelli) * Improve the descriptions of the stem_strategy values in the API docs. (Reported by "oilap" on #xapian) * docs/sorting.rst: Fix incorrect parameter types in Xapian::Weight subclass example. * docs/glossary.rst: Add definition of "collection frequency". * HACKING: + makeindex is now in Debian package texlive-binaries. + Replace a link to the outdated autotools "goat book" with a link to the "Portable Shell" chapter of the autoconf manual. * include/xapian/base.h: Remove very out of date comments talking about atomic assignment and locking - since 0.5.0 we've adopted a "user locks" policy. (Reported by Jean-Francois Dockes) examples: * delve: + Add -A option to list all terms with a particular prefix. + Send errors to stderr not stdout. + If -v is specified more than once, show even more info in some cases. (NEWS file claimed this was backported in 1.2.15, but it actually wasn't). * quest: + Add --default-op option. + Add --weight option to allow the weighting scheme to be specified. portability: * Explicitly '#include ' for std::max(), fixing build with VS2013. (Fixes#641, reported by "boomboo"). * Fix testcase blocksize1 not to try to delete an open database, which isn't possible under Windows. (Fixes #643, reported by Chris Olds) * docs/quickstart.rst: Split --cxxflags and --libs for portability (noted by "Hurricane Tong" on xapian-devel). * Fix warnings with clang 5.0. debug code: * Add assertions that weighting scheme upper bounds aren't exceeded. Xapian-core 1.2.17 (2014-01-29): API: * Enquire::set_sort_by_relevance_then_value() and Enquire::set_sort_by_relevance_then_key(): Fix sense of reverse parameter. Reported by "boomboo" on IRC. * BM25Weight: Fix case where (k1 == 0 || b == 0) but k2 != 0. Reported by "boomboo" on IRC. * Unicode::tolower(): Fix to give correct results for U+01C5, U+01C8, U+01CB, and U+01F2 (previously these were left unchanged). testsuite: * Automatically probe for and hook in eatmydata to the testsuite using the wrapper script it now includes. * Fix apitest to build when brass, chert or flint are disabled. brass backend: * Fix handling of invalid block sizes passed to Xapian::Brass::open() - the size gets fixed as documented, but the uncorrected size was passed to the base file (and abort() was called if 0 was passed). * Validate "dir_end" when reading a block. (fixes #592) chert backend: * Fix handling of invalid block sizes passed to Xapian::Chert::open() - the size gets fixed as documented, but the uncorrected size was passed to the base file (and abort() was called if 0 was passed). * Validate "dir_end" when reading a block. (fixes #592) flint backend: * Fix handling of invalid block sizes passed to Xapian::Flint::open() - the size gets fixed as documented, but the uncorrected size was passed to the base file (and abort() was called if 0 was passed). * Validate "dir_end" when reading a block. (fixes #592) build system: * configure: Improve reporting of GCC version. * Use -no-fast-install on platforms where -no-install causes libtool to emit a warning. * docs/Makefile.am: Fix handling of MAINTAINER_NO_DOCS. * Include UnicodeData.txt and the script to generate the unicode tables from it. documentation: * postingsource.rst: Clarify a couple of points (reported by "vHanda" on IRC). portability: * Protect the ValueIterator::check() method against Mac OS X SDK headers which define a check() macro. * Fix warning from xlC compiler. * Avoid use of grep -e in configure, as /usr/bin/grep on Solaris doesn't support -e. * Fix check for flags which might be needed for ANSI mode for compilers called 'cxx'. * configure: Improve handling of Sun's C++ compiler - trick libtool into not adding -library=Cstd, and prefer -library=stdcxx4 if supported. Explicitly add -library=Crun which seems to be required, even though the documentation suggests otherwise. Xapian-core 1.2.16 (2013-12-04): API: * PositionIterator,PostingIterator,TermIterator,ValueIterator: Don't segfault if skip_to() or check() is called on an iterator which is already at_end(). Reported by David Bremner. * ValueCountMatchSpy: get_description() on a default-constructed ValueCountMatchSpy object no longer fails when xapian-core is built with --enable-log. * ValueCountMatchSpy: get_total() on a default-constructed ValueCountMatchSpy object now returns 0 rather than segfaulting. testsuite: * If -v/--verbose is specified more than once to a test program, show the diagnostic output for passing tests as well as failing/skipped ones. * queryparsertest: Change qp_scale1 to time 5 repetitions of the large query to help average out variations. * queryparsertest: Add test coverage for explicit synonym of a term with a prefix (e.g. ~foo:search). * apitest: Remove code from registry* testcases which tries to test the consequences of throwing an exception from a destructor - it's complex to ensure we don't leak memory while doing this (it seems GCC doesn't release the object in this case, but clang does), and it's generally frowned upon, plus C++11 makes destructors noexcept by default. * Fix "make check" to actually removed cached databases first, as is intended. brass backend: * When moving a cursor on a read-only table, check if the block we want is in the internal cursor. We already do this for a writable table, as it is necessary for correctness, but it's a cheap check and may avoid asking the OS for a block we actually already have. * Correctly report the database as closed rather than 'Bad file descriptor' in certain cases. * Reuse a cursor for reading values from valuestreams rather than creating a new one each time. This can dramatically reduce the number of blocks redundantly reread when sorting by value. The rereads will generally get served from VM cache, but there's still an overhead to that. chert backend: * When moving a cursor on a read-only table, check if the block we want is in the internal cursor. We already do this for a writable table, as it is necessary for correctness, but it's a cheap check and may avoid asking the OS for a block we actually already have. * Correctly report the database as closed rather than 'Bad file descriptor' in certain cases. * Reuse a cursor for reading values from valuestreams rather than creating a new one each time. This can dramatically reduce the number of blocks redundantly reread when sorting by value. The rereads will generally get served from VM cache, but there's still an overhead to that. flint backend: * When moving a cursor on a read-only table, check if the block we want is in the internal cursor. We already do this for a writable table, as it is necessary for correctness, but it's a cheap check and may avoid asking the OS for a block we actually already have. * Correctly report the database as closed rather than 'Bad file descriptor' in certain cases. build system: * Compress source tarballs with xz instead of gzip. * Split XAPIAN_LIBS out of XAPIAN_LDFLAGS so that -l flags for libraries configure detects are needed appear after -L flags specified by the user that may be needed to find such libraries. (fixes#626) * XO_LIB_XAPIAN now handles the user specifying a relative path in XAPIAN_CONFIG, e.g.: "./configure XAPIAN_CONFIG=../xapian-core/xapian-config" * Adjust XO_LIB_XAPIAN to strip _gitNNN suffix from snapshot versions. * configure: Handle git snapshot naming when calculating REVISION. * configure: Enable -fshow-column for GCC - things like vim's quickfix mode will then jump to the appropriate column for a compiler error or warning, not just the appropriate line. * configure: Report GCC version in configure output. documentation: * The API documentation shipped with the release is now generated with doxygen 1.8.5 instead of 1.5.9, which is most evident in the different HTML styling newer doxygen uses. * Document how Utf8Iterator handles invalid UTF-8 in API documentation. * Improve how descriptions of deprecated features appear in the API documentation. * docs/remote_protocol.rst: Correct error in documentation of REPLY_DOCDATA message. * docs/overview.rst: Correct documentation for how to specify "prog" remote databases in stub files. * Direct users to git in preference to SVN - we'll be switching entirely in the near future. tools: * xapian-chert-update: Fix -b to work rather than always segfaulting (reported in https://bugs.debian.org/716484). * xapian-chert-update: The documented alias --blocksize for -b has never actually been supported, so just drop mentions of it from --help and the man page. * xapian-check: + Fix chert database check that first docid in each doclength chunk is more than the last docid in the previous chunk - previously this didn't actually work. + Fix database check not to falsely report "position table: Junk after position data" whenever there are 7 unused bits (7 is OK, *more* than 7 isn't). + Fix to report block numbers correctly for links within the B-tree. + If the METAINFO key is missing, only report it once per table. + Fix database consistency checking to always open all the tables at the same revision - not doing this could lead to false errors being reported after a commit interrupted by the process being killed or the machine crashing. Reported by Joey Hess in https://bugs.debian.org/724610 examples: * quest: Add --check-at-least option. portability: * configure: clang doesn't support -Wstrict-null-sentinel or -Wlogical-op, so don't pass it these options. * Fix build errors and warnings with mingw. * Suppress "unused local typedef" warnings from GCC 4.8. * If the compiler supports C++11, use static_assert to implement CompileTimeAssert. * tests/zlib-vg.c: Fix two warnings when compiled with clang. * Fix failure when built with -D_GLIBCXX_DEBUG - we were modifying the top() element of a heap before calling pop(), such that the heap comparison operation (which is called when -D_GLIBCXX_DEBUG is on to verify the heap is valid) would read off the end of the data. In a normal build, this issue would likely never manifest. * configure: When generating ABI compatibility checks in xapian/version.h, pass $CXXFLAGS and $CPPFLAGS to $CXXCPP as they could contain options which affect the ABI (such as -fabi-version for GCC). (Fixes #622) * Microsoft GUIDs in binary form have reversed byte order in the first three components compared to standard UUIDs, so the same database would report a different UUID on Windows to on other platforms. We now swap the bytes to match the standard order. With this fix, the UUIDs of existing databases will appear to change on Windows (except in rare "palindronic" cases). * Fix a couple of issues to get Xapian to build and work on AIX. * common/safeuuid.h: Remove bogus take-address-of from uuid handling code for NetBSD and OpenBSD. * Under cygwin, use cygwin_conv_path() if using a new enough cygwin version, rather than the now deprecated cygwin_conv_to_win32_path(). Reported by "Haroogan" on the xapian-devel mailing list. * common/safeuuid.h: Add missing '#include ' and qualify free with std. * Fix 'unused label' warning when chert backend is disabled. * xapian.h: Add check for Wt headers being included before us and defining 'slots' as a macro - if they are, give a clear error advising how to work around this (previously compilation would fail with a confusing error). debug code: * Fix assertion failure for when an OrPostList decays to an AndPostList - the ordering of the subqueries by estimated termfreq may not be the same as it was when the OrPostList was constructed, as the subqueries may themselves have decayed. Reported by Michel Pelletier. * Fix -Wcast-qual warning from GCC 4.7 when configured with --enable-log. Xapian-core 1.2.15 (2013-04-16): API: * QueryParser/TermGenerator: Don't include CJK codepoints which are punctuation in N-grams. * TermGenerator: Fix bug where we failed to generate the first bigram from the second sequence of N-grammable CJK characters in a piece of text. brass backend: * Call fdatasync()/fsync() when creating the "iambrass" file. chert backend: * Call fdatasync()/fsync() when creating the "iamchert" file. flint backend: * Call fdatasync()/fsync() when creating the "iamflint" file. build system: * XO_LIB_XAPIAN now handles the user specifying XAPIAN_CONFIG without a path, for example: ./configure XAPIAN_CONFIG=xapian-config-1.3 tools: * delve: If -v is specified more than once, show even more info in some cases. portability: * Fix warning due to needlessly casting away const-ness in debug logging. * Fix pointer truncation bug in lemon parser generator, which probably affects regenerating the query parser on WIN64. debug code: * Fix to build when configured with --enable-log. Xapian-core 1.2.14 (2013-03-14): API: * MSet::get_document(): Don't cache retrieved Document objects unless they were requested with fetch(). This avoids using a lot of memory when many MSet entries are retrieved. (Fixes #604) testsuite: * apitest: Improved test coverage. matcher: * Check if a candidate document has at least the minimum weight needed before checking positional information, which speeds up slow phrase searches (partly addresses #394). brass backend: * Fix multipass compaction not to damage document values, and to merge the database stats correctly. (fixes #615) chert backend: * Fix multipass compaction not to damage document values, and to merge the database stats correctly. (fixes #615) flint backend: * Fix multipass compaction bug. (fixes #615) tools: * xapian-replicate: + Fix handling of delays between replication events - the subtraction of the target time and the current time was reversed, so we wouldn't sleep when before the deadline, but would sleep after it for the amount we'd missed it by. + On Microsoft Windows, we no longer sleep for more than 43 years if the target time for a replication event had already passed. (Fixes #472) portability: * matcher/queryoptimiser.cc: Need for mem_fun(). * tests/harness/testsuite.cc: Don't provide explicit template types to make_pair - it isn't useful, and breaks with C++11. Fixes build error with MSVC2012. * examples/quest.cc: Fix to build with Sun Studio 12 compiler. (ticket#611) Xapian-core 1.2.13 (2013-01-09): API: * TermGenerator: Add new method TermGenerator::set_max_word_length() to allow this limit to be adjusted by the user. * QueryParser: Implicitly close any unclosed brackets at the end of the query string. Patch from Sehaj Singh Kalra. * DateValueRangeProcessor: Add extra constructor overloaded form so that in DateValueRangeProcessor(1, "date:"), the const char * gets interpreted as std::string rather than bool. testsuite: * apitest: Assorted test coverage improvements. * When reporting valgrind errors, skip any warnings before the error in the valgrind log. matcher: * Improved fix for #590 - count all matching LeafPostList objects with a Weight object rather than trying to prune at the MultiAndPostList level based on max_wt (if wdf is always zero for a term, BM25 gives max_wt of 0, which lead to us never counting that subquery. * Fix calculation of 0.0/0.0 in some cases. This then got used as a minimum weight, but it seems this gives -nan (at least on x86-64 Linux) so it may have been harmless in practice. * We no longer use the highest weighted MSet entry to calculate percentages, so remove code which finds it. brass backend: * Close excess file handles before we get the fcntl lock, which avoids the lock being released again if one is open on the lock file. Notably this avoids a situation where multiple threads in the same process could succeed in locking a database concurrently. chert backend: * Close excess file handles before we get the fcntl lock, which avoids the lock being released again if one is open on the lock file. Notably this avoids a situation where multiple threads in the same process could succeed in locking a database concurrently. flint backend: * Close excess file handles before we get the fcntl lock, which avoids the lock being released again if one is open on the lock file. Notably this avoids a situation where multiple threads in the same process could succeed in locking a database concurrently. remote backend: * Improve the UnimplementedError message for a MatchSpy subclass which doesn't implement name() so it's clearer that it is this particular subclass which can't be used remotely, rather than all MatchSpy objects. build system: * The build system is now generated with automake 1.11.6 rather than 1.11.1, which fixes a security issue in "make distcheck" (not something users will usually run, but it seems worth addressing). * Use user-specified LIBS for configure tests, which is what you'd expect to happen, and provides a way for the user to tell configure where to find library functions which configure can't find for itself. * INCLUDES is now deprecated in automake, so use AM_CPPFLAGS instead. * Test coverage rules now assume lcov 1.10 which allows them to be simpler and not to require a patched version of lcov. documentation: * valueranges.html: Update documentation to reflect change in Xapian 1.1.2 - DateValueRangeProcessor and StringValueRangeProcessor now support a prefix or suffix. * Clarify that the "reverse" parameter of set_sort_by_relevance_then_value() and set_sort_by_relevance_then_key() only affects the ordering of the value/key part of the sort. * docs/quickstart.html: Fix seriously outdated statement that Xapian doesn't create the database directory - that changed in 0.7.2 (released 2003-07-11). * HACKING: Try to make it clearer we're looking for a dual-licence on submitted patches. tools: * xapian-replicate: + Add a --full-copy option to force a full copy to be sent. (ticket#436) + Add --quiet option, and be a little more verbose by default. + Allow files > 32G to be be copied by replication. + Fix "if (fd > 0)" tests in some replication code to be "if (fd >= 0)". In practice this is unlikely to actually have caused problems since stdin is typically still open and using fd 0. + Simplify how we open the .DB file on the replication slave to just call open() once with O_CREAT, rather than once without, than stat() if that fails, and then again with O_CREAT|O_TRUNC if stat() doesn't show an ordinary file exists. examples: * quest: + New --flags command line option to allow setting arbitrary QueryParser flags. + Align option descriptions in --help output, and make the initial letter of such descriptions consistently lowercase. portability: * Fix testsuite harness to compile with GCC 4.7. * On platforms with the F_MAXFD fcntl but without closefrom(), we were failing to close the highest numbered open fd in our closefrom() replacement. * Our closefrom() replacement on Linux now works around valgrind not hiding some extra fds it has open, but then complaining if we try to close them. + Pass O_BINARY when opening replication related files in some cases where we weren't before, which will probably help solve ticket #472. * configure: socketpair() needs -lnetwork on Haiku. * Micro-optimisation in Unicode handling - GCC doesn't currently optimise the arithmetic shift right idiom we use, but it documents that signed right shift does sign extension so we now just use a right shift for GCC. debug code: * Preserve errno over debug logging calls, so they can safely be added to code which expects errno not to change. Xapian-core 1.2.12 (2012-06-27): build system: * 1.2.11 had its library version information incorrectly set. This resulted in the shared library having an incorrect SONAME - e.g. on Linux, libxapian.so.21 instead of libxapian.so.22. This release has been made to fix this problem. documentation: * AUTHORS: Add the GSoC students. Xapian-core 1.2.11 (2012-06-26): API: * Add new QueryParser::STEM_ALL_Z stemming strategy, which stems all terms and adds a Z prefix. (Patch from Sehaj Singh Kalra, fixes ticket#562) * Add TermGenerator::set_stemming_strategy() method, with strategies which correspond to those of QueryParser. Based on patch from Sehaj Singh Kalra, with some tweaks for adding term positions in more cases. (Fixes ticket#563) * Correct "BM25Weight" to "TradWeight" in exception message from TradWeight. * We were failing to call init() for user-defined Weight objects providing the term-independent weight. These now get called with init(0.0). * Xapian::Auto::open_stub() now throws a Xapian::DatabaseOpeningError exception if the stub file can't be opened. Previously we failed to check for this condition, which resulted in us treating the file as empty. testsuite: * When the testsuite is using valgrind, we used to run remote servers under valgrind too (but with --tool=none) to get consistent behaviour as valgrind's emulation of x87 excess precision isn't exact. Now we only do this if x87 FP instructions are actually in use (which means x86 architecture and configure run with --disable-sse). * Make sure XAPIAN_MAX_CHANGESETS gets unset after replication testcases which set it, so further testcases don't waste time generating changesets. * Improved test coverage (including more tests for closed databases - ticket#337). brass backend: * After closing the database, methods which try to use the termlist would throw FeatureUnavailableError with message "Database has no termlist", assuming that the termlist table not being open meant it wasn't present. Fix to check if the postlist_table is open to determine which case we're in. chert backend: * After closing the database, methods which try to use the termlist would throw FeatureUnavailableError with message "Database has no termlist", assuming that the termlist table not being open meant it wasn't present. Fix to check if the postlist_table is open to determine which case we're in. inmemory backend: * Check if the database is closed in metadata_keys_begin() for InMemory Databases. build system: * xapian-config: Don't interpret a missing .la file as meaning that we only have static libraries. documentation: * Fix API documentation for Query constructors - both XOR and ELITE_SET can take any number of subqueries, not only exactly two. * Backport missing API documentation comments for operator++ and operator* methods or PositionIterator, PostingIterator and TermGenerator. * docs/replication.rst: Update documentation - since 1.2.5, the value of XAPIAN_MAX_CHANGESETS determines how many changesets we keep. * docs/admin_notes.rst: Correction - we don't "create a lock file", we "lock a file". * Fix API documentation for TradWeight constructor - "k1" should be "k". portability: * configure: Overhaul handling of compilers which pretend to be GCC. Clang is now detected, and we only pass it warning flags it actually understands. And we now check for symbol visibility support with Intel's compiler. * configure: Solaris automatically pulls in library dependencies, so set link_all_deplibs_CXX=no there. * configure: We now check -Bsymbolic-functions for all compilers. * configure: Enable -Wdouble-promotion for GCC >= 4.6. * Pass -ldl last when compiling zlib-vg.so, as that seems to be needed on Ubuntu 12.04. * Fix incorrect use of "delete" which should be "delete []". This is undefined behaviour in C++, though the type is POD, so in practice this probably worked OK on many platforms. * In BM25Weight when k1 or b is zero (not the default), we used to multiply an uninitialised double by zero, which is undefined behaviour, but in practice will often give zero, leading to the desired results. * xapian.h: Add check for Qt headers being included before us and defining 'slots' as a macro - if they are, give a clear error advising how to work around this (previously compilation would fail with a confusing error). Xapian-core 1.2.10 (2012-05-09): testsuite: * apitest: Extend tradweight1 to test that TradWeight(0) means that wdf and document length don't affect the weight of a term. * termgentest: Check that TermGenerator discards words > 64 bytes. matcher: * Don't count unweighted subqueries of MultiAndPostList in percentage calculations, as OP_FILTER maps to MultiAndPostList now. (ticket#590) brass backend: * When compacting, if the output database is empty, don't write out a metainfo tag. Take care not to divide by zero when computing the percentage size change for a table. chert backend: * When compacting, if the output database is empty, don't write out a metainfo tag. Take care not to divide by zero when computing the percentage size change for a table. documentation: * API documentation: + Note version when Database::close() was added. + Fix switched lower and upper in API documentation for Weight methods get_doclength_lower_bound() and get_doclength_upper_bound(). Correct maximum to minimum in get_doclength_lower_bound() comment and note that this excludes zero length documents. Fix "An lower" to "A lower". * docs/admin_notes.html: Mention that postlist and termlist tables also hold value info for chert. Mention that xapian-chert-update was removed in 1.3.0. Mention that you need to use copydatabase from 1.2.x to convert flint to chert. * HACKING: Update section on patches to mention git (git diff and git format-patch), and using "-r" with normal diff, and also that ptardiff offers a nice way to diff against an unpacked tarball. debug code: * Fix use of AssertEq() on NULL, which doesn't compile, at least with recent GCC. Xapian-core 1.2.9 (2012-03-08): API: * QueryParser: Fix FLAG_AUTO_SYNONYMS not to enable auto multi-word synonyms too (but in a different way to trunk so as to not break the ABI). matcher: * Fix issue with running AND, OR and XOR queries against a database with no documents in it - this was leading to a divide by zero, which led to MSet::get_matches_estimated() reporting 2147483648 on i386. build system: * Remove configure's --with-stlport and --with-stlport-compiler options, as they don't allow you to actually specify what you need to (at least to use the Debian STLport package), and instead document what to pass to configure to enable building with STLport (though it seems to no longer be actively maintained, and the debug mode (which is probably the most interesting feature now) doesn't seem to work on Debian stable). documentation: * Document that OP_ELITE_SET with non-term subqueries might pick subqueries which don't match anything. Closes ticket#49. * Document that you can define a static operator delete method in your subclass if deallocation needs to be handled specially. (Closes ticket#554) * Assorted minor documentation improvements. portability: * Address new warnings from GCC 4.6. * Fix argument order when linking xapian-check to fix mingw build. (ticket#567) * Add some missing explicit header includes to fix build with STLport. Xapian-core 1.2.8 (2011-12-13): API: * Add support to TermGenerator and QueryParser for indexing and searching CJK text using n-grams. Currently this is only enabled when the environmental variable XAPIAN_CJK_NGRAM is set to a non-empty value. documentation: * Add link from index page to apidoc.pdf. * quickstart.html: Correct link which was to quickstartsearch.cc.html but should be to quickstartindex.cc.html. * overview.html,quickstart.html: Fix several factual errors. * API documentation: + Improve documentation comments for several methods. + Add documentation for function parameters which didn't have it. + Remove bogus paragraph in WritableDatabase::replace_document() documentation comment which had been cut and pasted from delete_document() documentation comment. (Fixes ticket#579) + Explicitly document which value slot numbers are valid. (Fixes ticket#555) + Escape < and > in doxygen comments so "" doesn't get eaten by doxygen. portability: + Some fixes for warnings when cross-compiling to mingw. * tests/soaktest/soaktest.cc: With Sun's compiler, random() and srandom() aren't in so we need to use instead. Xapian-core 1.2.7 (2011-08-10): API: * Document objects now track whether any document positions have been modified so that replacing a modified document can completely skip considering updating positions if none have changed. Currently the flint, chert, and brass backends implement this optimisation. A common case this speeds up is adding and/or removing boolean filter terms to/from existing documents - for example this gives an 18% speedup for adding tags in notmuch. testsuite: * Make sure that perftest isn't run with libeatmydata preloaded, as making fsync() a no-op makes performance tests rather bogus. remote backend: * Remove unnecessary call to reopen() in the remote servers in a case where either we had just called it or we are using a writable database and so reopen() doesn't do anything. build system: * configure: -Wshadow gives bogus warnings with 4.0 (at least on Mac OS X), so disable it for GCC < 4.1 (like the comments already said we did!) documentation: * Improve the documentation comment for Database::close(). (ticket#504) * Fix typo in documentation comment for Enquire constructor which reversed the intended sense (though the text was fairly obviously wrong before). * Improve documentation of QueryParser::add_boolean_prefix()'s exclusive parameter to talk about terms and prefixes rather than values and fields (which was confusing since "document value" has a particular meaning in Xapian). * docs/facets.html: Expand descriptions for indexing and finding facets. Fix errors in example code. * docs/index.html: Add links to Omega and bindings documentation. * docs/remote_protocol.html: Fixed typo which reversed the intended sense. * xapian-check --help: Document that checking a whole database performs additional cross-checks between the tables. * docs/admin_notes.html: Add note about xapian-chert-update. * docs/deprecation.html: Note here that WritableDatabase::flush() is deprecated in favour of WritableDatabase::commit(). portability: * Fix -Wshadow warnings from GCC 4.6. * Fix warning from GCC 3.3. debug code: * Fix some problems with the templates used to implement output of parameters and return values in debug logging. Xapian-core 1.2.6 (2011-06-12): API: * QueryParser: + Add new set_max_wildcard_expansion() method to allow limiting the number of terms a wildcard can expand to. (ticket#350) + If default_op is OP_NEAR or OP_PHRASE then disable stemming of the terms, since we don't index positional information for stemmed terms by default. * Spelling correction was failing to correctly handle words which had the same trigram in an even number of times. testsuite: * We now actually include the soaktest code in the release tarballs. matcher: * Eliminate some vector copies when handling phrase subqueries in the query optimiser. brass backend: * Kill the child process which holds the lock with SIGKILL as that can't be ignored, whereas SIGHUP can be in some cases. chert backend: * Kill the child process which holds the lock with SIGKILL as that can't be ignored, whereas SIGHUP can be in some cases. flint backend: * Kill the child process which holds the lock with SIGKILL as that can't be ignored, whereas SIGHUP can be in some cases. documentation: * The HTML documentation is now maintained in reStructured Text format. * docs/queryparser.html: Document the precedence order of operators. * docs/scalability.html: Bring up-to-date. * docs/overview.html: Document "remote" in stub databases. * docs/postingsource.html: Add PostingSource example. (ticket#503) * include/xapian/database.h: Add @exception InvalidArgumentError for Database::get_document() (ticket#542). * Ship ChangeLog.0 in the tarball. * Assorted minor improvements. examples: * examples/delve: Report has_positions(). * examples/simpleindex: Add short description to usage message. portability: * Fix to build for mingw. Xapian-core 1.2.5 (2011-04-04): API: * Enquire::get_eset() now accepts a min_wt argument to allow the minimum wanted weight to be specified. Default is 0, which gives the previous behaviour. * QueryParser: Handle NEAR/ and ADJ/ where offset isn't an integer the same way at the end of the query as in the middle. * Replication: + Only keep $XAPIAN_MAX_CHANGESETS changeset files when generating a new one (previously this variable only controlled if we generated changesets or not). Closes ticket#278. + $XAPIAN_MAX_CHANGESETS is reread each time, rather than only when the database is opened. + If you build Xapian with DANGEROUS mode enabled, changeset files now actually have the appropriate flag set (the reader will currently throw an exception, but that's better than quietly handling them incorrectly). testsuite: * Compaction tests which generate stub files now close them before performing the actual compaction, to avoid issues on Microsoft Windows (ticket#525). * Improve test coverage. matcher: * Fix memory leak if an exception is thrown during the match. brass backend: * Bumped format version number (we now store the oldest revision for which we might have a replication changeset). * Optimise not to read the bitmaps from the base files when opening a database for reading (cross-port of equivalent change to chert). * Optimise not to update doclength when it hasn't changed (cross-port of equivalent change to chert). * If we try to delete an old base file and it isn't there, just continue rather than throwing an exception. We wanted to get rid of it anyway, and it may be NFS issues telling us the wrong thing. In particular, DatabaseCorruptError was rather a pessimistic assessment. chert backend: * Optimise not to read the bitmaps from the base files when opening a database for reading. * Optimise not to update doclength when it hasn't changed. * xapian-chert-update: Fix to handle larger databases, and databases which have values set. * If we try to delete an old base file and it isn't there, just continue rather than throwing an exception. We wanted to get rid of it anyway, and it may be NFS issues telling us the wrong thing. In particular, DatabaseCorruptError was rather a pessimistic assessment. flint backend: * Optimise not to read the bitmaps from the base files when opening a database for reading (cross-port of equivalent change to chert). * Optimise not to update doclength when it hasn't changed (cross-port of equivalent change to chert). * If we try to delete an old base file and it isn't there, just continue rather than throwing an exception. We wanted to get rid of it anyway, and it may be NFS issues telling us the wrong thing. In particular, DatabaseCorruptError was rather a pessimistic assessment. remote backend: * xapian-tcpsrv: If we can't bind to the specified port because it is a privileged one, exit with code 77 (EX_NOPERM) to make it easier to automatically handle failure when starting the server from a script. build system: * Snapshots and releases are now bootstrapped with autoconf 2.68 and libtool 2.4. * configure: -Wstrict-null-sentinel was added in GCC 4.0.1 and so doesn't work with GCC 4.0.0. For simplicity, only enable it for GCC >= 4.1. documentation: * INSTALL: Note how to build for a non-default arch on a multi-arch platform. * include/xapian/enquire.h: Fix doxygen markup so alternative overloaded forms of Enquire::get_mset() appear in the API documentation. * collapsing.html: Add missing document (written some time ago, but never actually added to builds). * replication.html: Update documentation to make it clear that users shouldn't create the destination directory for replication themselves. * docs/intro_ir.html: Update link to a paper. Update text about book "to be published in 2008". * docs/deprecation.html: + PostingSource now offers a replacement for Enquire::set_bias(). + OmegaScript: $set{spelling,true} is now deprecated. + Add note about botched removal of Enquire.get_matching_terms from Python bindings (now fully removed). + Note removal of "if idx in mset" from Python bindings. + Deprecate MSet.items and ESet.items from Python bindings (ticket#531). * docs/admin_notes.html: Update for 1.2.5. * Updates to documentation of internals. tools: * xapian-replicate-server: Fix race condition between checking if a file exists and opening it to replicate it. * xapian-replicate: Complain unless host name and port number are specified - previously these defaulted to an empty string and 0, which resulted in potentially confusing error messages. * xapian-replicate: If --master isn't specified, default to DATABASE. examples: * quest: Report any spelling correction (requires the database contains spelling data of course). * copydatabase: Add --no-renumber option. portability: * api/compactor.cc: Add missing header for time() (ticket#530). * api/compactor.cc: Use msvc_posix_rename() under __WIN32__ to atomically update stub file after compaction (ticket#525). * Fix uninitialised variable warnings with gcc -O3. * Eliminate std::string member of global static object used when compiled with --enable-log which was causes problems on Mac OS X. * Fix some issues highlighted by clang++ warnings. Xapian-core 1.2.4 (2010-12-19): API: * QueryParser: + Avoid a double free if Query construction throws an exception in a particular case. Fixes ticket#515. + Allow phrase generators between a probabilistic prefix and the term itself (e.g. path:/usr/local). + The correct window size wasn't being set in some cases when default_op was set to OP_PHRASE. * Enquire::get_mset(): + Avoid pointlessly trying to allocate lots of memory if the first document requested is larger than the size of the database. + An empty query now returns an MSet with firstitem set correctly - previously firstitem was always 0 in this case. * Document: Initialise docid to 0 when creating a document from scratch, as documented. * Compactor: + Move the database compaction and merging functionality into this new class, and make xapian-compact a simple wrapper around this class. (ticket#175) + Inputs can now be stub database directories or files, in which case the databases in the stub are used as inputs. + Add support for compacting to a stub database, which can be one of the inputs (for atomic update). + If spellings and/or synonyms were only present in some source databases, they weren't copied to the output database, but now they are. testsuite: * Improve test coverage (particularly for Xapian::Utf8Iterator and Xapian::Stem). * Add zlib-vg.c to distribution tarballs. * tests/runtest: Add XAPIAN_TESTSUITE_LD_PRELOAD hook to allow libeatmydata to easily be used to speed up testsuite runs. matcher: * The matcher wasn't recalculating the max possible weight after a subquery of XOR reached its end. This caused an assertion failure in debug builds, and is a missed optimisation opportunity. * Implement SelectPostList::check() so that check() on OP_NEAR and OP_PHRASE subqueries will just check a single document, not a potentially huge numbers of documents. * BM25Weight: Fix calculation order to avoid inconsistent weights due to rounding when certain non-default parameter combinations are used. * TradWeight: Fix calculation order to avoid inconsistent weights due to rounding with TradWeight(0). * Fix regression in speed of OP_OR queries in certain cases due to optimisation added in 1.0.21/1.2.1. * In the query optimiser, use value range bounds to detect value ranges which must be empty. remote backend: * Add support for iterating metadata keys with the remote backend. This change necessitated an increase in the minor version of the remote protocol. If you are upgrading a live system which uses the remote backend, upgrade the servers before the clients. build system: * xapian-config: Add --static option which makes other options report values for static linking. * xapian-config is now removed by "make distclean" not "make clean". * configure: FreeBSD and OpenBSD don't need explicit dependency libraries, so set link_all_deplibs_CXX=no there. * This release uses autoconf 2.67 rather than 2.65. documentation: * INSTALL: Raise recommended GCC version from 3.3 to 4.1, since that's the oldest we regularly test with. * replication.html: Update and improve in various ways. * Remove lingering "experimental" marker from PostingSource and ValueCountMatchSpy API documentation. * index.html: Add links to replication and facets documents, and fix typo in serialisation document link. * internals.html: Add link to replication protocol. * Change the categorisation document to talk about facets, since that's the terminology that seems to be most widely used these days, and "categorisation" can also mean automatically assigning categories to documents. Also update to reflect the final API. * deprecation.html: Add guidelines for supporting other software. * Document cases where QueryParser's FLAG_WILDCARD and FLAG_PARTIAL aren't currently supported. * PLATFORMS: Move PLATFORMS information to the wiki and replace with a pointer. tools: * xapian-compact: Fix access to empty priority_queue while merging synonyms. This could have caused problems, though we've had no reports of any (the bug was found with _GLIBCXX_DEBUG). * xapian-compact: Add --quiet/-q option to suppress progress output. (ticket#437) * xapian-replicate: If a full copy was attempted, but was not put live, display an explanatory message (in verbose mode). examples: * examples/quest: Add command line options to allow prefixes to be specified for the QueryParser. * examples/delve: Add '-z' option to count zero-length documents. * examples/simplesearch: Fix cut-and-paste errors in usage message and --version output. portability: * configure: Add support for --enable-sse=sse and --enable-sse=sse2 to allow control of which SSE instructions to use. * configure: Enable use of SSE maths on x86 by default with Sun's compiler. * configure: Beef up the test for whether -lm is required and add a special case to force it to be for Sun's C++ compiler - there's some interaction with libtool and/or shared objects which means that the previous configure test didn't think -lm is needed here when it is. * Fix to build on OpenBSD 4.5 with GCC 3.3.5. * Need to avoid excess precision on m68k when targeting models 68010, 68020, 68030 as well as 68000. * Fix compilation with Sun's C++ compiler. * Fix testsuite to build on Solaris < 10. Xapian-core 1.2.3 (2010-08-24): API: * Database::get_spelling_suggestion() will now suggest a correction even if the passed word is in the dictionary, provided the correction has at least the same frequency. Partly addresses #225. * QueryParser: + Fix handling of groups of terms which are all stopwords - in situations where this causes a problem we now disable stopword checks for such groups. (ticket#245) + Fix to be smarter about handling a boolean filter term containing ".." in the presence of valuerangeprocessors. testsuite: * New "unittest" program for testing low level functions directly. Currently this has tests for the internal resolve_relative_path() function. (ticket#243) remote backend: * Retry select() if it fails with EINTR while waiting for connect(), and discriminate cases with same failure message to aid debugging. documentation: * Fix documentation comment for Xapian::timeout type - it holds a time interval in milliseconds not microseconds (the API docs for the methods which use it explicitly correctly document that the timeouts are in milliseconds). * libuuid moved from e2fsprogs to util-linux-ng about a year ago, so update documentation, comments, and configure error messages to reflect this. portability: * configure: Don't pass -mtune=generic unless GCC >= 4.2 is in use (ticket#492). * Fix handling of some obscure cases of resolving relative paths on Microsoft Windows. (ticket#243). * Optimise closing of all unwanted file descriptors after forking by using closefrom() if available, and otherwise providing our own implementation (optimised to some extent for many platforms). * Fix test harness to build under Microsoft Windows (ticket#495). packaging: * xapian-core.spec: Add xapian-metadata and cmake related files to RPM packaging. * xapian-core.spec: Update BuildRequires to specify libuuid-devel instead of e2fsprogs-devel. debug code: * Improve logging of function parameter placeholder strings. Xapian-core 1.2.2 (2010-06-27): brass backend: * Sync changes from each Btree table to disk right after syncing changes to its base file, which allows more time for the table changes to be written and may also be more efficient with some Linux kernel versions. chert backend: * Sync changes from each Btree table to disk right after syncing changes to its base file, which allows more time for the table changes to be written and may also be more efficient with some Linux kernel versions. tools: * xapian-check: Don't try to check document lengths are consistent between the postlist and termlist tables if it would use more than 1GB of memory, and handle std::bad_alloc or std::length_error when trying to allocate space for this. This issue affected sup users, as sup allocates docids such that they are sparse and large docids can easily occur. examples: * delve: Show the database's UUID. portability: * Revert 1.2.1 change to visibility of Xapian::Weight's copy constructor as it making it private broke compilation with GCC 4.1 (which seems to be a bug in this compiler version). * tests/harness/testsuite.cc: Need for sprintf(). Fixes compilation error which was masked if valgrind was installed. (ticket#489) packaging: * xapian-core.spec: Update for 1.2.x - add e2fsprogs-devel to BuildRequires and add new files to install. Xapian-core 1.2.1 (2010-06-22): This release includes all changes from 1.0.21 which are relevant. API: * QueryParser: Add support for open-ended ranges (ticket#480). * Add new optional parameter to QueryParser::add_boolean_prefix() to allow the user to indicate a prefix isn't "exclusive" and that multiple instances should be combined with OP_AND rather than OP_OR. Fixes ticket#402. This change should also improve efficiency as it avoids copying the lists of prefixes and compares them more efficiently. * You can now specify a custom stemming algorithm by subclassing Xapian::StemImplementation, mostly based on patch from Evgeny Sizikov in ticket#448. * Fix replication bug: when multiple commits were made to the master database while a client was performing a full copy, the client would only apply the first changeset and then try to make the database live, but fail due to trying to set the wrong revision number. * Replication no longer sleeps between applying changesets to an offline database. It's only necessary to sleep for a live database (to allow readers to complete a search without getting DatabaseModifiedErrror. * xapian-replicate: Add new "-r" command line option to specify how long replication sleeps for between applying changesets to a live database. * If a Btree table doesn't exist when applying a replication changeset, create it. This fixes replicating a revision where a lazy table is created. (ticket#468) testsuite: * zlib can produce "uninitialised" output from "initialised" input - the output does decode to the input, so this is presumably just some unused bits in the output, so we use an LD_PRELOAD hack to get valgrind to check the input is initialised and then tell it that the output is initialised. * Don't pass NULL to closedir(), which fixes test harness failures on platforms without /proc/self/fd. * Use safesyswait.h, fixing build failure on "make check" on FreeBSD. * Check is SA_SIGINFO is defined before using it as it isn't available everywhere. Fixes testsuite build failure on GNU Hurd. * Add a "soaktest" testsuite, intended to contain long-running tests with random data. Currently contains a single test which builds and runs random queries, checking that the results returned are consistent when asking for different result ranges. * Test UUID returned by Database::get_uuid() is 36 characters long. matcher: * Xapian no longer forces the wdf_max value to be at least one in BM25Weight::get_maxpart(). We used to do this so that a non-existent term in the query would cause it not to achieve 100%, but now we calculate percentages based on the number of matching subqueries, and it is more natural for a non-existent term to get zero weight (ditto for a term which always has wdf 0). * OP_VALUE_RANGE and OP_VALUE_GE now use value streams directly which is much more efficient for chert (the default backend in 2.2.x). As an example, a range query testcase which previously took 29 seconds now takes 0.4 seconds (70 times faster). (ticket#432) * The term statistics from multiple databases are now gathered in a simpler way which is a bit faster and uses less memory. build system: * Install headers under PREFIX/include not PREFIX/include/xapian. If you used XO_LIB_XAPIAN or xapian-config in your build system, the headers would still have been found. * Releases and snapshots are now generated with libtool 2.2.10 instead of 2.2.6. * Fix build failures with some combinations of backends disabled (partially addresses ticket#361 - some combinations still fail). * Add check to configure that GCC actually supports visibility for the platform being built for, which fixes compiler warnings with platforms which don't (such as Mac OS X and mingw). documentation: * Update documentation - replication and PostingSource aren't experimental in 1.2.x. portability: * Make use of built-in UUID API on FreeBSD and NetBSD. (ticket#470) * Fix mingw build. debug code: * Add new pretty printer for values reported by calls and returns in debug logging - in particular, strings are now reported with non-printable characters escaped. * Debug logging should have less runtime overhead when built in but not in use. * Drop support for --enable-log=profile - dedicated profiling tools are likely to return more useful results. Xapian-core 1.2.0 (2010-04-28): This release includes all changes from 1.0.20 which are relevant. testsuite: * Fix --abort-on-error to actually work. * Exit with status 1 not 0 if we caught an exception from the harness itself. Xapian-core 1.1.5 (2010-04-16): This release includes all changes from 1.0.19 which are relevant. API: * Database replication now handles an exception while applying a changeset better. * If environment variable XAPIAN_MAX_CHANGESETS is set on a replication client then any changesets read are saved so the replicated copy can itself be replicated. testsuite: * Use sigsetjmp() and siglongjmp() where available so that the set of blocked signals get restored and the test harness can catch a second incidence of a particular signal in a run. Use sigaction() instead of signal() where available, which allows us to report the address associated with SIGSEGV, SIGFPE, SIGILL, and SIGBUS. * Add machinery to check for leaked file descriptors. Currently this requires /proc/self/fd to work (which is present on Linux and some other platforms). Remove the crude ulimit in runtest which has caused problems on some Debian buildds. * The test harness now explicitly catches const char * exceptions and reports their contents. brass backend: * Ensure that the wdf upper bound is correctly updated when replacing documents. * xapian-compact: Now sets lastdocid correctly when using --no-renumber. chert backend: * Ensure that the wdf upper bound is correctly updated when replacing documents. * xapian-compact: Now sets lastdocid correctly when using --no-renumber. * xapian-check: Check that the initial doclen chunk exists. flint backend: * xapian-compact: Now sets lastdocid correctly when using --no-renumber. remote backend: * Add remote backend support for WritableDatabase::add_spelling() and WritableDatabase::remove_spelling(). This bumps the remote protocol to version 35.0 (so both client and servers will need updating). Suggesting spelling corrections isn't yet supported. (ticket#178) build system: * XO_LIB_XAPIAN: Give a more specific error message for the cases where XAPIAN_CONFIG isn't found, is a directory, or isn't executable. examples: * delve: + If any documents are specified with "-d", "-V" now only show values for those documents. + Remove undocumented -k option, which has been a compatibility alias for -V since 0.9.10. Just use -V instead. * xapian-metadata: Add new example program which allows you to get and set individual user metadata entries. Xapian-core 1.1.4 (2010-02-15): This release includes all changes from 1.0.18 which are relevant. API: * Xapian::TermGenerator,Xapian::QueryParser,Xapian::Unicode::is_wordchar(): Add ENCLOSING_MARK and COMBINING_SPACING_MARK categories to is_wordchar(), which is used by TermGenerator and QueryParser. Also make TermGenerator and QueryParser ignore several zero-width space characters. This is a better but less compatible version of a fix in 1.0.18. * Implement support for iterating valuestreams for multidatabases. * Xapian::Stem: Update the german and german2 stemming algorithms to the latest versions from Snowball. These add an extra rule for the "-nisse" ending. * Xapian::ValueCountMatchSpy: Replace get_values() with values_begin() and values_end(). * Xapian::MatchSpy: Provide an iterator for accessing the top values found instead of taking a vector by reference to return them in. * Xapian::NumericRanges: Remove experimental API we aren't happy with yet. * Xapian::DatabaseReplica, Xapian::DatabaseMaster: Remove experimental API we aren't happy with. Replication is still supported via the command line programs. (ticket#347) * Xapian::score_evenness(): Remove as it turns out not to be useful in practice. (ticket#435) * Xapian::ValueWeightPostingSource: A ValueWeightPostingSource with no entries would report -infinity as its upper bound, which could cause no results to be incorrectly returned for some queries involving such an object. * Xapian::WritableDatabase::close() fixed to commit() changes (unless a transaction is in progress). testsuite: * apitest: Improve test coverage in various places. matcher: * Uses of values during the match (sorting by value or Sorter, MatchSpy, MatchDecider, and collapsing) now use value stream iteration which is a lot more efficient for chert and brass (but may be slower for flint). brass backend: * New development backend. Changes over chert: + Batched posting list changes during indexing use significantly less memory. + Instead of using complex code to iterate modified posting lists and documents length lists, brass can flush individual such lists to disk and then iterates them from there. + To iterate all terms, chert flushes all pending postlist changes. In the case where a prefix is specified, brass only flushes postlist changes for terms starting with the specified prefix, and doesn't flush document length changes. chert backend: * Promote chert to being the stable backend. * Change the packing of integers and strings into sortable keys, which reduces database size by 2.5% in tests. This means an incompatible change in the chert format. You can use the new xapian-chert-update utility to update a chert database from the old format to the new format. It works much like xapian-compact so should take a similar amount of time (and results in a compact database). * xapian-compact: + Prune unused docids off the end of each database when merging multiple databases with renumbering. + Extend --no-renumber to support merging databases, but only if they have disjoint ranges of used document ids. + Ensure that the resultant database has a fresh UUID (previously chert copied the UUID from the first input). * xapian-check: + Fix checking of the METAINFO key in chert. For small databases, the statistics fit in few enough bytes that incorrect check appeared to succeed and no errors were reported, but for larger databases an error was incorrectly reported. + Rework the checking of postlist chunks to use a cleaner approach which should report errors better. + Use a type wider than 32 bits to keep count of items in a table. Previously xapian-check would report the number of entries modulo 4294967296. * When iterating a value stream, skip_to() now only assigns the value to a std::string when it reaches its target. This saves a lot of unnecessary string copying - in a real-world test it improved the time for 100 queries from 3.66s to 3.10s. * When skipping through a chunk of postings to find the one we want, don't bother to unpack the wdf values we're skipping over. This should save a significant amount of time in certain cases where the profile data shows about a third of the time is spent in the function where this happens. * Report locking failure due to running out of file descriptors better. flint backend: * xapian-compact: + Prune unused docids off the end of each database when merging multiple databases with renumbering. + Ensure that the resultant database has a fresh UUID (previously flint didn't set a UUID so one would be generated on demand when next requested, but only if the database was writable). * Report locking failure due to running out of file descriptors better. remote backend: * Add support for WritableDatabase::set_metadata() and Database::get_metadata() to the remote backend (based largely on patch in #178). inmemory backend: * Read the document data and values lazily for the inmemory backend like we do for other backends. They're much less costly to fetch than if a disk or network access is involved, but it avoids copying potentially large data which may not be needed. Consistency here also makes things easier to understand for both users and developers. build system: * This release uses autoconf 2.65 rather than 2.64. documentation: * docs/replication.html: Add note about not using reopen() with databases being updated by the replication client. * docs/admin_notes.html: Update for chert and other recent changes. * Remove out-of-date reference in the API documentation comment to an add_slot() method. This no longer exists - you need to use multiple ValueCountMatchSpy objects to monitor more than one slot. examples: * simpleexpand,simpleindex,simplesearch: Handle --help and --version. debug code: * The debug log now reports boolean values as "true" and "false" (instead of "1" and "0"). Xapian-core 1.1.3 (2009-09-18): This release includes all changes from 1.0.15-1.0.17 which are relevant. API: * Update Unicode character database to Unicode 5.2. (ticket#351) * Rename Xapian::Sorter to Xapian::KeyMaker, paving the way for using it to build collapse keys too. Xapian::Sorter remains for compatibility (and is now a subclass of Xapian::KeyMaker) but is deprecated. * Resolve the inconsistency in MultiValueSorter::add()'s "forward" parameter versus the "reverse" parameters which the Enquire sorting functions now take by replacing the class with MultiKeyMaker with a renamed method add_value() with a "reverse" parameter. MultiValueSorter remains with the old semantics for compatibility but is deprecated. (ticket#359) * QueryParser: Don't apply spelling correction to wildcarded terms, or to terms at the end of the query which we expand under FLAG_PARTIAL. * Add new Error subclass SerialisationError which we throw for serialisation related errors (which previously mostly threw NetworkError. * Rename Xapian::SerialisationContext to Xapian::Registry. * Add DecreasingValueWeightPostingSource class, which reads weights from a value slot in which a significant range of the values are in decreasing order. This functions similarly to ValueWeightPostingSource, but can be much more efficient. * Add new Xapian::MatchSpy class: + This replaces the use of Xapian::MatchDecider as a "matchspy", which is now deprecated. The new class only inspects, and can't reject. It can work with remote databases, with the results being serialised to return them across the link. + Add subclass ValueCountMatchSpy, which counts the occurrences of each value in a slot in the search results seen (useful for faceted or categorisation systems). The results can be grouped into ranges using the NumericRange and NumericRanges classes, and the score_evenness() function. This API is currently experimental. * Remove default implementation of Weight::clone() which returns NULL. We always need clone() to be implemented because it's called for every term in the query, not just used for the remote backend. chert backend: * Rewrite the low level packing and unpacking functions more efficiently. As well as being generally faster, the pack functions now take a reference to a string to append to, which avoids creating a lot of temporary string objects. Indexing HTML files with omindex is 5-10% faster. Searching for "The" on gmane (which results in a lot of unpacking of postings and document lengths) is about 35% faster. (ticket#326) * xapian-compact: Don't report an absent lazy input table as 0 size. * Fix ChertModifiedPostList to skip added-but-then-deleted-before-flush documents. (ticket#392) * Fix WritableDatabase::get_doclength() to work properly after a call to commit for the chert backend (ticket#397). * Fix to work with the metainfo key stored in the latest format of chert databases. * Avoid doing pointless work by trying to delete non-existent lists of values when we're just adding documents. * Fix code to find the first docid in the next chunk (ticket#399). * Add support for chert databases without a termlist table (ticket#181). Currently the only way to create such a database is to create a chert database and do "rm termlist.*". flint backend: * xapian-compact: Don't report an absent lazy input table as 0 size. remote backend: * Remote protocol major version has changed to support serialising MatchSpy objects. * Fixed not to sometimes read off the end of the returned matches when searching multiple databases, some of which are remote, and when the primary ordering is by relevance. build system: * This release uses autoconf 2.64 rather than 2.63. This means configure now makes use of shell functions, which makes it ~13% smaller, and should also make it execute faster. * configure: Send stderr output from ldconfig to config.log. * Add optional third parameter to XO_LIB_XAPIAN autoconf macro which specifies the basename for the "xapian-config" script (defaults to "xapian-config" to give the current behaviour). * This release uses doxygen 1.5.9 to generate the API documentation. documentation: * Minor improvements to the formatting of the collated API documentation. portability: * Fix code to compile with Sun's C++ compiler. * Fix our uuid_unparse_lower() replacement for older libuuid to actually compile (really fixes ticket#368). * Fix xapian-config to work with Solaris 10 /bin/sh. (ticket#405) debug code: * Use C++ syntax for NULL with a type in log output. Xapian-core 1.1.2 (2009-07-23): This release includes all changes from 1.0.14 which are relevant. API: * Move support for a prefix/suffix from NumberValueRangeProcessor to StringValueRangeProcessor, and change NumberValueRangeProcessor and DateValueRangeProcessor to inherit from StringValueRangeProcessor so all three now support a prefix/suffix. (ticket#220) * Query: Trim 4 bytes off the internals. (ticket#280) * QueryParser: If default_op is OP_NEAR or OP_PHRASE then make the window size (9 + no_of_terms) to match the default for an explicit NEAR or PHRASE. (ticket#254) testsuite: * Sort out the clash between two different patches to fix leaking file descriptors when running tests with the remotetcp backend (broken by changes in 1.1.1). matcher: * If the highest weighted document doesn't match all the terms in the query, its percentage weight is now calculated by simply counting how many weighted leaf subqueries match it instead of scaling by the proportion of the weight which matches (which required accessing the termlist for that document). (ticket#363). * XOR with a SYNONYM subquery could previously achieve 100% - this has been fixed. flint backend: * Backport the lazy update changes from chert to flint: WritableDatabase::replace_document() now updates the database lazily in simple cases - for example, if you just change a document's values and replace it with the same docid, then the terms and document data aren't needlessly rewritten. Caveats: currently we only check if you've looked at the values/terms/data, not if they've actually been modified, and only keep track of the last document read. build system: * Update to always use C++ forms for ISO C standard headers (ticket#330). * Fix several places where Xapian::doccount is used instead of Xapian::termcount, and similar issues. It's still not possible to make these types different sizes, but we're now closer to this goal. (ticket#385). documentation: * Note that PostingSource and Weight objects returned by clone() and unserialise() methods will be deallocated with "delete". debug code: * Fix debug logging not to segfault on NULL Query::Internal pointers. Xapian-core 1.1.1 (2009-06-09): This release includes all changes from 1.0.13 which are relevant. API: * New Query::OP_SYNONYM operator, which matches the same documents as OP_OR, but attempts to weight as if the all the subqueries were a single term with their combined wdf, which should give better relevance weights. * QueryParser's synonym, wildcard, and partial query features now use the new OP_SYNONYM operator. * PostingSource: Add new set_maxweight() method to allow subclasses to tell the matcher that their maximum weight has decreased. Make get_maxweight() a non-virtual method of the baseclass which returns the last set maxweight (which will require updates to most user subclasses. (ticket#340) * DatabaseReplica: Fix SEGV when calling get_description() on a default constructed DatabaseReplica. * Make Query::MatchAll and Query::MatchNothing const since they're immutable. All the public methods of Query are const, so this should be completely API compatible. * Methods returning an end iterator for a ValueIterator now actually return a proxy object which silently converts to ValueIterator if required. This proxy object allows a comparison with an "_end()" method to be optimised better so that it just ends up comparing the internal member of the iterator class with NULL (previously a call to ValueIterator's destructor remained). This should be API compatible, but note that it is definitely now more efficient just to compare against the return value of the relevant _end() method than to store the end iterator explicitly. testsuite: * Testcase valuestats4 requires transactions, so indicate that and remove the explicit SKIP for inmemory. * Testcase changemaxweightsource1 uses ChangeMaxweightPostingSource, which doesn't work with multi or remote, so mark the test accordingly. * We've decided that "going back" with skip_to() or check() should have unspecified behaviour, so stop testing how this case behaves! matcher: * Subclass MultiPostList directly from PostList instead of from LeafPostList. This gets rid of two unused data members per MultiPostList in exchange for having to define 5 extra "never called" methods, but 4 of these just tailcall. * Store termfreqs and reltermfreqs for query terms in a single map rather than one map for each, which saves is more compact and likely to be faster. chert backend: * xapian-check: For chert, check value stats are the correct format and that the streamed values are consistent with their stats (ticket#277). * xapian-check: Chert doesn't store termlist entries for documents without terms, which resulted in us reporting an error when we found document ids in the doclength "postlist" which were greater than any with an entry in the termlist. Instead compare these entries against db.get_last_docid() if we are checking a whole db and the db can be opened. If not, suppress this check. remote backend: * When serialising stats, serialise the termfreq and reltermfreq together, rather than in separate lists. This gives a smaller serialised form, and matches these both being stored in the same map now. This is an incompatible remote protocol change, so bump the major version to 32. (ticket#362) build system: * Some build failures with --disable-backend-XXX options have been fixed, but we haven't exhaustively tested all combinations. * Ship common/win32_uuid.cc and common/win32_uuid.h (ticket#367). documentation: * Update PostingSource documentation to describe how init() is called again if a PostingSource is reused. Fixes #352. portability: * Fixed to build with GCC 4.4. * Drop support for GCC 2.95.3 and 3.0.x - we now require at least 3.1 as doing so eliminates some preprocessor conditionals which we aren't able to test regularly as we don't have easy access to such old GCC versions. GCC 3.1 is nearly 7 years old now, and GCC3 didn't get widespread use until later versions anyway. If you still need to use GCC < 3.1, Xapian 1.0.x should build with 2.95.3 or newer. * Older versions of libuuid don't have uuid_unparse_lower() so probe for it in configure, and if it isn't present provide an inline version in safeuuid.h (ticket#368). * Fixed to build with MSVC (ticket#379). * Add static_cast() to str(bool) overload to suppress bogus MSVC warning (ticket#377). debug code: * common/debuglog.h: Add missing initialisation of uncaught_exception variable in a couple of places. Xapian-core 1.1.0 (2009-04-22): API: * All deprecated xapian-core features listed for removal in 1.1.0 have been removed. See deprecation.html for details, and suggested updates. * The Unicode character categorisation functions have been updated from Unicode 5.0 to 5.1. * Add NON_SPACING_MARK to is_wordchar() for better tokenisation of languages which use such marks - for example, Arabic. This is better than the stop-gap fix in 1.0 of treating NON_SPACING_MARK as a phrase-generator character when parsing queries, but it does mean that databases built from data containing such characters will need to be rebuilt. (ticket#355) * The details of how to subclass Xapian::Weight to implement your own weighting scheme have changed incompatibly to allow user weighting schemes to have access to the same statistics as built-in schemes (ticket#213) If you have a existing subclass of Xapian::Weight you'll need to update it. * New Database methods get_doclength_upper_bound(), get_doclength_lower_bound() and get_wdf_upper_bound(), primarily intended for allowing weighting schemes to calculate tighter upper bounds on weights (which BM25Weight and TradWeight now do) which allows matcher weight-based optimisations to be more effective. Chert actually tracks doclength bounds and a global (rather than per term) upper bound on wdf; other backends return much less tight bounds, but these still lead to better upper bounds on weights. * Enquire::get_eset() now uses an unmodified of probabilistic formula, and doesn't return terms which would get a negative weight from it (since that means they are expected to be harmful not helpful). * Add Database::close() method, which will release system resources (in particular, close filehandles) held by a database. This is particularly useful when wrapping the API for languages with garbage collection. * Change Database::positionlist_begin() not to throw exceptions if the term or document doesn't exist. * Xapian databases now have a UUID, readable with Database::get_uuid(). * A new Database replication API has been added (currently experimental). * MSet::get_termfreq() will now fall back to looking up the term frequency in the database rather than raising an exception if a term wasn't present in the query. * Calling RSet:add_document() with argument 0 now throws InvalidArgumentError. * QueryParser sped up (new version of lemon); queryparsertest runs 2.2% faster. * Add ValueSetMatchDecider, which is a matchdecider which is intended to be passed a set of values to look for in documents, and selects documents based on the presence of those values. * Add new Xapian::PostingSource class to allow passing custom sources of postings and weights to the matcher. Built-in PostingSource subclasses: FixedWeightPostingSource, ValueMapPostingSource, ValuePostingSource, and ValueWeightPostingSource. (Currently experimental). * Database: Add get_value_freq(), get_value_lower_bound() and get_value_upper_bound() methods to get statistics about the values stored in a slot. Add support for the value statistics methods to chert, inmemory, multi and remote databases. * Enquire::get_eset() now faster for large ESet size. * Xapian::Document objects now have a reduced memory footprint. * Enquire::set_collapse_key() now allows you to specify a maximum number of matches with each collapse key to keep (which defaults to 1, giving the previous behaviour). Enquire can now report bounds and an estimate of what the total number of matches would have been if collapsing wasn't in use. * WritableDatabase::commit() is a new, preferred alias for WritableDatabase::flush(). (ticket#266) * Add methods for serialising documents and queries to strings, and unserialising back from strings. (ticket#206) testsuite: * stemtest: No longer checks environment variables OM_STEMTEST_SKIP_RANDOM, OM_STEMTEST_LANGUAGES, and OM_STEMTEST_SEED. * perftest: New performance testsuite. This is intended to contain intended to contain potentially time-consuming performance tests, which log output to an XML file for later analysis. It's not run by "make check" - use "make check-perf" to run it. * apitest: Now runs tests over both flint and chert for multi, remotetcp, and remoteprog. * Wait for subprocesses to finish at end of tests with remotetcp backend, to avoid test failures when the same database is used for the next testcase. matcher: * Internally, pass around non-normalised document lengths as Xapian::termcount (unsigned integer) not Xapian::doclength (double). This gives a 3% speedup for 10 term OR queries! chert backend: * New development backend. Use Chert::open() to explicitly create a chert format database, or set XAPIAN_PREFER_CHERT=1 in the environment to prefer chert when creating a new database without an explicit type. * Quartz and Flint stored the document length alongside every posting list entry. Chert instead stores a chunked list of all the document lengths which saves a lot of space, and is a big win for large queries or those which don't need the document lengths. This structure is used to implement much faster iteration (six times faster in a test) over all document ids (which speeds up queries using unary NOT, e.g. `NOT apples'), and to test for the existence of documents (instead of checking the record table for an entry). * Document values are now stored in a chunked stream for each slot for efficient access to the same slot in lots of documents. This makes operations like sort by value much more efficient. * WritableDatabase::replace_document() now updates the database lazily in simple cases - for example, if you just change a document's values and replace it with the same docid, then the terms and document data aren't needlessly rewritten. Caveats: currently we only check if you've looked at the values/terms/data, not if they've actually been modified, and only keep track of the last document read. flint backend: * If we can't obtain a write lock while trying to create a new database we now report the lock failure with DatabaseLockError, not DatabaseOpeningError - it's more useful to know that the lock attempt failed in this situation. * Improve reporting of failures to obtain lock due to unexpected errors. * xapian-check: Don't stop checking a table after an error in certain cases - instead increment the error counter and try to continue checking from the next item. remote backend: * The remote database protocol major version has been increased, allowing a significant amount of compatibility code to be removed. This change means that new clients won't work with old servers, and old clients won't work with new servers. If upgrading a live system, you will need to take this into account. * The remote servers now always default to opening a Database and the client has to send a protocol message to explicitly request write access. This allows a single server to support multiple readers and one writer simultaneously. (ticket#145) * Database::get_document() no longer does an unnecessary copy of the document's values. * Change serialisation of queries to be more compact and easier to parse. stub databases: * Stub databases used to assume that any relative paths were relative to the current working directory. They now assume that relative paths are relative to the directory holding the stub database file. * Stub database lines which begin with a '#' character are now ignored, allowing comments in stub database files. * New "stub directory" database type - this is a directory containing a stub database file named "XAPIANDB". * Don't just ignore lines with no spaces in a stub database file. * Bad lines in a stub file were being ignored after we'd seen a good entry. * Add new Auto::open_stub() overload which opens a stub database file containing a single entry as a WritableDatabase. * Add support for "inmemory" to stub database (which is useful now that stub databases can be opened for writing). * A stub database file is now allowed to contain no database entries, which results in an empty Database object (this avoids user code having to special case to handle "0 or more" databases). build system: * To allow installations of Xapian 1.0 and 1.1 to easily coexist, the library is now libxapian-1.1; xapian.m4 is now xapian-1.1.m4; headers are now installed in $prefix/include/xapian-1.1. If you use XO_LIB_XAPIAN or xapian-config as we recommend, this should all be transparent. Also programs and scripts have a default program suffix to -1.1 unless overridden using the --program-suffix argument to configure (if you really want no suffix, "./configure --program-suffix=" will achieve this). * On Linux and k*bsd-gnu, override libtool's link_all_deplibs_CXX to "no". * On Linux, override libtool's sys_lib_dlsearch_path_spec to a list generated in a more reliable way which includes all the default directories. * configure: --enable-debug and --enable-debug-verbose have been deprecated since 1.0.0, so remove specific errors pointing to the replacements. documentation: * Disable "JAVADOC_AUTOBRIEF" in doxygen configuration since we always try to write a brief description explicitly, and JAVADOC_AUTOBRIEF causes problems in some cases. * docs/deprecation.html: Describe what "experimental" features are, and why replication and posting sources are currently experimental. * docs/deprecation.html: Deprecate Stem_get_available_languages() from the python bindings. examples: * Use C++ forms of C headers in examples (ticket#330). packaging: * xapian-core.spec: We no longer need to run autoreconf to work around libtool's incomplete sys_lib_dlsearch_path_spec or to pick up distro-specific patches for link_all_deplibs. debug code: * Report get_description() rather than the pointer value for Xapian::Query::Internal* parameters to internal functions. * The debug logging framework has been overhauled. See HACKING for details of how it now works. * Faster integer to string functions inside the library (this is a general improvement, but will particularly speed up debug logging as that converts a lot of integers to strings). Xapian-core 1.0.23 (2011-01-14): API: * QueryParser: Avoid a double free if Query construction throws an exception in a particular case. Fixes ticket#515. * QueryParser: Handle NEAR/ and ADJ/ where offset isn't an integer the same way at the end of the query as in the middle. * Enquire::get_mset(): Avoid pointlessly trying to allocate lots of memory if the first document requested is larger than the size of the database. * Enquire::get_mset(): An empty query now returns an MSet with firstitem set correctly - previously firstitem was always 0 in this case. matcher: * The matcher wasn't recalculating the max possible weight after a subquery of XOR reached its end. This caused an assertion failure in debug builds, and is a missed optimisation opportunity. tools: * xapian-compact: Fix access to empty priority_queue while merging synonyms. This could have caused problems, though we've had no reports of any (the bug was found with _GLIBCXX_DEBUG). Xapian-core 1.0.22 (2010-10-03): API: * Xapian::Document: Initialise docid to 0 when creating a document from scratch, as documented. * Xapian::QueryParser: Allow phrase generators between a probabilistic prefix and the term itself (e.g. path:/usr/local). matcher: * Back out the OP_OR efficiency improvement made in 1.0.21 since this change slows down some other common cases. We'll address this fully in 1.2.4, but that fix is more invasive than we are comfortable with for 1.0.x at this point. build system: * xapian-config: Add --static option which makes other options report values for static linking. documentation: * deprecation.html: Add guidelines for supporting other software. * Document cases where QueryParser's FLAG_WILDCARD and FLAG_PARTIAL aren't currently supported. * Fix documentation for Xapian::timeout type - it holds a time interval in milliseconds not microseconds (the API docs for the methods which use it explicitly correctly document that the timeouts are in milliseconds). portability: * configure: Don't pass -mtune=generic unless GCC >= 4.2 is in use (ticket#492). * configure: Add support for --enable-sse=sse and --enable-sse=sse2 to allow control of which SSE instructions to use. * configure: Enable use of SSE maths on x86 by default with Sun's compiler. * configure: Beef up the test for whether -lm is required and add a special case to force it to be for Sun's C++ compiler - there's some interaction with libtool and/or shared objects which means that the previous configure test didn't think -lm is needed here when it is. * Fix test harness to build under Microsoft Windows (ticket#495). * Fix to build on OpenBSD 4.5 with GCC 3.3.5. * Need to avoid excess precision on m68k when targeting models 68010, 68020, 68030 as well as 68000. packaging: * xapian-core.spec: Add cmake related files to RPM packaging. Xapian-core 1.0.21 (2010-06-18): API: * Xapian::Stem now recognises "nb" and "nn" as additional codes for the Norwegian stemmer. * Xapian::QueryParser now correctly parses a wildcarded term in between two other terms (ticket#484). testsuite: * Improve test coverage of OP_VALUE_RANGE and MSet::get_percent(). matcher: * OP_OR could skip a matching document if it decayed to OP_AND or OP_AND_MAYBE during the match in some cases. Fixes ticket#476. * OP_XOR with non-leaf subqueries could skip matching documents in some cases, and OP_XOR of three or more sub-queries could return incorrect weights. Fixes ticket#475. * OP_OR is now more efficient if a subquery is potentially expensive (e.g. ValueRangePostList, OP_NEAR, OP_PHRASE). A 10-fold speed-up with ValueRangePostList has been observed. flint backend: * When iterating a table, if the table changes underneath we could end up returning the same entry twice. (Debian#579951) * A cancelled transaction (or a failing operation implicitly cancelling pending changes) now marks the tables as unmodified, which fixes an exception trying to read block 0 if one of the tables is empty on disk. quartz backend: * When iterating a table, if the table changes underneath we could end up returning the same entry twice. (Debian#579951) remote backend: * When daemonising, read the max fd to close with sysconf() instead of using a hardcoded value of 256, and work even if stdin and stdout have been closed. build system: * Install files to make Xapian easier to use with cmake. documentation: * Update the list of languages that the Xapian::Stem constructor recognises. * Assorted minor improvements to the collated API documentation. portability: * On x86 processors, Xapian now defaults to using SSE2 FP instructions. This avoids issues with excess precision and it a bit faster too. If you need to support processors without SSE2 (this means pre-Pentium4 for Intel) then configure with --disable-sse. (ticket#387) * Fix warning when compiling for mingw with GCC 4.2.1. * Remove mutable from a couple of reference class members - mutable doesn't make sense for a reference and some compilers warn about it. Xapian-core 1.0.20 (2010-04-27): API: * MSet: Fix incorrect values reported by get_matches_estimated(), get_matches_lower_bound(), and get_matches_upper_bound() in certain cases when sorting and collapsing (ticket#464). documentation: * deprecation.html: Note how to disable deprecation warnings. (ticket#393) examples: * delve: Add -a option to list all terms in a database. * delve: -d and -V command line options now report out of range and invalid numbers. portability: * The getopt warning fix for Cygwin in 1.0.19 caused build failures on Mac OS X (and probably some other platforms with non-GNU getopt implementations), so replace with a fix which is only enabled for Cygwin. (ticket#469) Xapian-core 1.0.19 (2010-04-15): API: * QueryParser: Fix leak if Xapian::Database throws an exception during parsing (ticket#462). testsuite: * Explicitly flush after indexing for quartz and flint, so we see any exceptions from the flush (the implicit flush from the destructor swallows any exceptions). * apitest: Add databasemodified1 testcase to provide some test coverage for DatabaseModifiedError. flint backend: * When updating a document, rather than decoding the old positions, comparing with the new, and then encoding the new if different, we now just encode the new and then compare the encoded forms. (ticket#428) * Avoid trying to delete the document positions when we know there aren't any. * Fix memory leak if Database::allterms_begin() throws an exception (ticket#462). * xapian-check: Report document id for document length mismatch. * Fix potential issues with iterators over a WritableDatabase which is modified during iteration. No problems have actually been observed with flint, only in 1.1.4 with chert in cases which don't occur in flint, but it seems likely the issue can manifest for flint in other situations. Fixes ticket#455. * Initialise zlib z_stream structure members zalloc, zfree, and opaque with Z_NULL rather than 0 cast to the appropriate type, as that's what the zlib documentation says to do. Add missing initialisation of opaque for the inflate z_stream which the zlib docs say is needed (reading the zlib code, this isn't true for current versions, so this improves robustness rather than fixing an observable bug). * Don't memcpy() a block to itself - it's a waste of effort, and (probably) undefined behaviour (as a block overlaps itself). quartz backend: * Fix potential issues with iterators over a WritableDatabase which is modified during iteration. No problems have actually been observed with quartz, only in 1.1.4 with chert in cases which don't occur in quartz, but it seems likely the issue can manifest for quartz in other situations. Fixes ticket#455. * Don't memcpy() a block to itself - it's a waste of effort, and (probably) undefined behaviour (as a block overlaps itself). build system: * Force -fno-strict-aliasing for GCC 4.2 to avoid bad code being generated due to a bug in that compiler version. Fixes ticket#449. This issue hasn't been observed to affect Xapian 1.0.x, but it seems prudent to backport the fix. documentation: * INSTALL: Correct description of --enable-assertions. It does NOT enable debugging symbols, and shouldn't control checks on bad data passed to API calls (if it does anywhere, that's a bug). Note that Xapian will run more slowly with assertions on. * spelling.html: + Add section on indexing. + Add a note about removing automatically added spelling dictionary entries. + Move the "algorithm" section to the end, as it is really just background information for the curious. * include/xapian/queryparser.h: Document the possible exception messages from QueryParser::parse_query(). * include/xapian/termgenerator.h: Note how TermGenerator handles stopwords. examples: * delve: Display the lastdocid value when displaying general database statistics. * simpleindex: Explicitly call flush() on the database, as that is good practice (since you see any exceptions). portability: * Fix compilation failure in testsuite on OpenBSD, introduced by new regression test in 1.0.18. Fixes ticket#458. * Fix getopt-related warning on Cygwin. Xapian-core 1.0.18 (2009-02-14): API: * Document: Add new add_boolean_term() method, which is an alias for add_term() with wdfinc=0. * QueryParser: + Add support for quoting boolean terms so they can contain arbitrary characters (partly addresses ticket#128). + Add ENCLOSING_MARK and COMBINING_SPACING_MARK categories, plus several zero-width space characters, as phrase generators. This mirrors a better fix in 1.1.4, but without losing compatibility with existing databases. + Fix handling of an explicit AND before a hated term (foo AND -bar). (ticket#447) * TermIterator: Only include trailing '+' or '#' on a term if it isn't followed by a word character (makes more sense and matches QueryParser's behaviour). (ticket#446) * Database: Fix many methods to behave better on a database with no subdatabases, such as is constructed by Database(). Fixes ticket#415. testsuite: * Add test coverage for xapian-compact, and improve coverage for WritableDatabase::replace_document(). * apitest: Rename matchfunctor to matchdecider to match current terminology. flint backend: * When updating documents, don't update posting entries which haven't changed. Largely fixes ticket #250. * If the number of entries in the position table happened to be 4294967296 or an exact multiple, Xapian would ignore positional data for that table when running queries, and xapian-compact wouldn't copy its contents. * Iterating all the terms in the database with a prefix is now slightly more efficient. * Fix locking code to work if stdin and/or stdout have been closed. * If a document is replaced with itself unmodified, we no longer increase the automatic flush counter. * When iterating a posting list modified since the last flush(), the reported wdf is now correct (previously it was too high by its old value). * Replacing a document deleted since the last flush failed to update the collection frequency and wdf, and caused an assertion failure when assertions were enabled. * WritableDatabase::replace_document() didn't always remove old positional data (the only effect is that the position table was bloated by unwanted entries). * xapian-inspect: + New "until" command which shows entries until a specified key is reached. + New "open" command which allows easy switching between tables. * xapian-compact: Fix typos in --help output. quartz backend: * Replacing a document deleted since the last flush failed to update the collection frequency and wdf, and caused an assertion failure when assertions were enabled. * WritableDatabase::replace_document() didn't always remove old positional data (the only effect is that the position table was bloated by unwanted entries). remote backend: * Throw UnimplementedError if a MatchDecider is used with the remote backend. Previously Xapian returned incorrect results in this case. build system: * configure: With --enable-maintainer-mode, enable -Werror for GCC >= 4.1 rather than >= 4.0 as Apple's GCC 4.0 gives bogus uninitialised variable warnings. documentation: * The API documentation now includes Xapian::Error and subclasses, and doesn't mention Xapian::Query::Internal. * Make clear in the Xapian::Document API documentation that this class is a lazy handle and discuss the issues this can cause. * INSTALL: Improve text about zlib dependency. * HACKING: Add details of our licensing policy for accepting patches. examples: * quest: If no database is specified, still parse the query and report Query::get_description() to provide an easy way to check how a query parses. portability: * Fix GCC 4.2 warning. xapian-core 1.0.17 (2009-11-18): API: * QueryParser: + Fix handling of a group of two or more terms which are all stopwords which notably caused issues when default_op was OP_AND, but could probably manifest in other cases too. Fixes ticket#406. + Fix interaction of FLAG_PARTIAL and FLAG_SYNONYM. (ticket#407) * Database: A database created via the default constructor no longer causes a segfault when the methods get_metadata() or metadata_keys_begin() are called. flint backend: * Don't try to close the fd one more than the maximum allowable when locking the database. Harmless, except it causes a warning when running under valgrind. (ticket#408) remote backend: * Xapian::Sorter isn't supported with the remote backend so throw UnimplementedError rather than giving incorrect results. (ticket#384) * Fix potential reading off the end of the MSet which is returned internally by the remote server. documentation: * Various documentation comment improvements for the Database class. examples: * examples/quest.cc: Tighten up the type of the error we catch to detect an unknown stemming language. portability: * xapian-config: Need to quote ^ for Solaris /bin/sh. * configure: Actually use any flags we determine are needed to switch the compiler to proper ANSI C++ mode, when building xapian-core - this stopped working in 1.0.12, breaking support for HP's aCC, Compaq's cxx, Sun's CC, and SGI's CC. Xapian-core 1.0.16 (2009-09-10): flint backend: * Fix a typo which stopped this fix in 1.0.12 from working (ticket #398): If we fail to get the lock after we spawn the child lock process (the common case is because the database is already open for writing) then we now clean up the child process properly. documentation: * Improve API documentation of QueryParser::set_default_op() and QueryParser::get_default_op(). portability: * Fix build failure on Mac OS X 10.6. Xapian-core 1.0.15 (2009-08-26): testsuite: * Fix the test harness not to report heaps of bogus errors when using valgrind 3.5.0. flint backend: * Backport the lazy update changes from 1.1.2: WritableDatabase::replace_document() now updates the database lazily in simple cases - for example, if you just change a document's values and replace it with the same docid, then the terms and document data aren't needlessly rewritten. Caveats: currently we only check if you've looked at the values/terms/data, not if they've actually been modified, and only keep track of the last document read. * Fix PostingIterator::skip_to() on an unflushed WritableDatabase to skip documents which were added and deleted since the last flush. (ticket#392) documentation: * Overhaul the doxygen options we use and tweak various documentation comments to improve the generated API documentation. * Explicitly document that an empty prefix argument to QueryParser::add_prefix() means "no prefix". * Update the documentation comments for Enable::set_sort_by_value(), set_sort_by_value_then_relevance(), and set_sort_by_relevance_then_value() to mention sortable_serialise() as a good way to store numeric values for sorting. Xapian-core 1.0.14 (2009-07-21): API: * When using more than one ValueRangeProcessor, QueryParser didn't reset the begin and end strings to ignore any changes made by a ValueRangeProcessor which returned false, so further ValueRangeProcessors would see any changes it had made. This is now fixed, and test coverage improved. testsuite: * The test harness code which launches xapian-tcpsrv child processes was failing to close a file descriptor for each one launched due to a bug in the code which is meant to track them. This was causing apitest to fail on OpenBSD (ticket#382). Also wait between testcases for any spawned xapian-tcpsrv processes to exit to avoid spurious failures when a database is reused by the next testcase. * tests/runtest.in: Use "ulimit -n" where available to limit the number of available file descriptors to 64 so we catch file descriptor leaks sooner. * When measuring CPU time used for scalability tests, we no longer try to include the CPU time used by child processes, as we can only get that for child processes which have exited and it's hard to ensure that they have with the current framework. Although this means we only tests the client-side scaling for remote tests, the local backend tests cover most of the work done by the server part of the remote backend. * apitest: In testcase topercent2, don't expect max_attained or max_possible to be exact as rounding errors in different ways of calculating can cause small variations. On trunk we already have similar code because the new weighting scheme stuff gives different bounds in the different cases. This should fix testsuite failures seen on some of the Debian and Ubuntu buildds. * The test harness now always reports the full exception message (was conditional on --verbose), and output for different exception types and other causes of failure is now more consistent. * For scalability tests, the test harness now increases the number of repetitions until the first run takes more than 0.001 seconds, to avoid trying to base calculations on a length of time we probably can't reliably measure to start with. * Add test coverage for Stem::get_description() for each supported language. * queryparsertest: Reenable tests which require the inmemory backend to be enabled by fixing typo XAPIAN_HAS_BACKEND_INMEMORY -> XAPIAN_HAS_INMEMORY_BACKEND. flint backend: * Use F_FULLFSYNC where available (Mac OS X currently) to ensure that changes have been committed to disk. (ticket#288) remote backend: * Fix handling of percentage weights in various cases when we're searching multiple remote databases or a mix of local and remote databases. build system: * configure: -Wshadow produces false positives with GCC 4.0, so only enable it for >= 4.1 since we enable -Werror for maintainer-mode builds for GCC >= 4.0. * configure: Check that we can find the valgrind/memcheck.h header as well as the valgrind binary. * Change how snowball generates the data used by its among operation - instead of using pointers to the strings in struct among, store an offset into a constant pool, as this reduces the number of relocations by about 2300, which should decrease the time taken by the dynamic linker when loading the library. This also reduces the size of the shared library significantly (on x86-64 Linux, the stripped shared library is 4% smaller). Xapian-core 1.0.13 (2009-05-23): API: * Xapian::Document no longer ever stores empty values explicitly. This wasn't intentional behaviour, and how this case was handled wasn't documented. The amended behaviour is consistent with how user metadata is handled. This change isn't observable using Document::get_value(), but can be noticed when iterating with Document::values_begin(), using Document::values_count(), or trying to delete the value with Document::remove_value(). testsuite: * Fix testcase scaleweight4 not to fail on x86 when compiled with -O0. The problem was in the testcase code, and was caused by excess precision in intermediate FP values. * Testcases which check that operations have the expected O(...) behaviour now check CPU time instead of wallclock time on most platforms, which should eliminate occasional failures due to load spikes from other processes. (ticket#308) * Fix test failures due to SKIP_TEST_FOR_BACKEND("inmemory") not skipping when it should due to comparing char * strings with == (on trunk the return value being tested is std::string rather than const char *). * Improve test coverage in several corner cases. * Fix testcase consistency2 to actually be run (fortunately it passes). * In the generated testcases, call get_description() on the default constructed object of each class to make sure that works (and doesn't try to dereference NULL, or fail some assertion, etc). All currently checked classes are fine - this is to avoid future regressions or such problems with new classes. * In the test coverage build, use "--coverage" instead of "-fprofile-arcs -ftest-coverage". * The test harness now has the inmemory backend flagged as supporting user-specified metadata (apart from iteration over metadata keys). matcher: * If a query contains a MatchAll subquery, check for it before checking the other terms so that the loop which checks how many terms match can exit early if they all match. * When an OR or ANY_MAYBE decayed to an AND, we were carefully swapping the children for maximum efficiency, but the condition was reversed so we were in fact making things worse. This was noticed because it was resulting in the same query running faster when more results were asked for! * Only build the termname to termfreq and weight map for the first subdatabase instead of rebuilding it for each one. Also don't copy this map to return it. This should speed up searches a little, especially those over multiple databases. * If a submatcher fails but ErrorHandler tells us to continue without it, we just use a NULL pointer to stand in rather than allocating a special dummy place-holder object. * Remove AndPostList, in favour of MultiAndPostList. AndPostList was only used as a decay product (by AndMaybePostList and OrPostList), and doesn't appear to be any faster. Removing it reduces CPU cache pressure, and is less code to maintain. * Call check() instead of skip_to() on the optional branch of AND_MAYBE. flint backend: * Fix a bug in TermIterator::skip_to() over metadata keys. remote backend: * Fix xapian-tcpsrv --interface option to work on MacOS X (ticket#373). * Fix typo which caused us to return the docid instead of the maximum weight a document from a remote match could return! This could have led to wrong results when searching multiple databases with the remote backend, but probably usually didn't matter as with BM25 the weights are generally small (often all < 1) while docids are inevitably >= 1. inmemory backend: * The inmemory backend doesn't support iterating over metadata keys. Trying to do so used to give an empty iteration, but has now been fixed to throw UnimplementedError (and this limitation has now been documented). build system: * Remove a lot of unused header inclusions and some unused code which should make the build faster and slightly smaller. * Fix to compile under --disable-backend-flint, --disable-backend-remote, and --disable-backend-inmemory. * Don't remove any built sources in "make clean" even under --make-maintainer-mode as that breaks switching a tree away from maintainer-mode with: make distclean;./configure * configure: Enable more GCC warnings - "-Woverloaded-virtual" for all versions, "-Wstrict-null-sentinel" for 4.0+, "-Wlogical-op -Wmissing-declarations" for 4.3+. Notably "-Wmissing-declarations" caught that consistency2 wasn't being run. * Internally, fix the few places where we pass std::string by value to pass by const reference instead (except where we need a modifiable copy anyway) as benchmarking shows that const reference is slightly faster and generates less code with GCC's reference counted std::string implementation - with a non-reference counted implementation, const reference should be much faster. (ticket#140) documentation: * INSTALL: We no longer regularly test build with GCC 2.95.4 and we're raising the minimum GCC version required to 3.1 for Xapian 1.1.x. * Document what passing maxitems=0 to Enquire::get_mset() does. * docs/queryparser.html: Add examples of using a prefix on a phrase or subexpression. * Correct doxygen comments for user metadata functions: Database::get_metadata() can't throw UnimplementedError but WritableDatabase::set_metadata() can. * Document that Database::metadata_keys_begin() returns an end iterator if the backend doesn't support metadata. * HACKING: Update the list of Debian/Ubuntu packages needed for a development environment. debug code: * Fix build with --enable-debug. * Added some more assertions. Xapian-core 1.0.12 (2009-04-19): API: * WritableDatabase::remove_spelling() now works properly. * The QueryParser now treats NON_SPACING_MARK Unicode characters as phrase generators, which improves handling of Arabic. This is a stop-gap solution for 1.0.x which will work with existing databases without requiring reindexing - in 1.1.0, NON_SPACING_MARK will be regarded as part of a word. (ticket#355) * Fix undefined behaviour in distribution of OP_NEAR and OP_PHRASE over a non-leaf subquery (indentified by valgrind on testcase nearsubqueries1). (ticket#349) * Enhance distribution of OP_NEAR/OP_PHRASE over non-leaf subqueries to work when there are multiple non-leaf subqueries (ticket#201). * Enquire::get_mset() no longer needlessly checks if the documents exist. * PostingIterator::get_description() output improved visually in some cases. testsuite: * Add make targets to assist generating a testsuite code coverage report with lcov. See HACKING for details. * Improved test coverage in a number of places and removed some used code as shown by lcov's coverage report. flint backend: * xapian-compact: + Now handles databases which contains no documents but have user metadata (ticket#356). + Fix test for the total document length overflowing. * Release the database lock if the database is closed due to an unrecoverable error during modifications. (ticket#354) * If we fail to get the lock after we spawn the child lock process (the common case is because the database is already open for writing) then we now clean up the child process properly. build system: * Overriding CXXFLAGS at make-time (e.g. "make CXXFLAGS=-Os") no longer overrides any flags configure detected to be required to make the compiler accept ISO C++ (for GCC, no such flags are required, so this doesn't change anything). documentation: * Update documentation and code comments to reflect that 1.1 will be a development series, and 1.2 the next release series. * docs/admin_notes.html: Document the child process used for locking which exec-s "cat" (ticket #258). * include/xapian/unicode.h: Fix documentation comment typos. * include/xapian/matchspy.h: Removed currently unused header to stop doxygen from generating documentation for it. Xapian-core 1.0.11 (2009-03-15): API: * Enquire::get_mset(): + Now throws UnimplementedError if there's a percentage cutoff and sorting is primarily by value - this has never been correctly supported and it's better to warn people than give incorrect results. + No longer needlessly copies the results internally. + When searching multiple databases, now recalculates the maximum attainable weight after each database which may allow it to terminate earlier. (ticket#336). + Fix inconsistent percentage scores when sorting primarily by value, except when a MatchDecider is also being used; document this remaining problem case. (ticket#216) * Enquire::set_sort_by_value() (and similar methods): Rename the wrongly named "ascending" parameter to "reverse", and note that its value should always be explicitly given since defaulting to "reverse=true" is confusing and the default will be deprecated in 1.1.0. (ticket#311) * Database::allterms_begin(): Fix memory leak when iterating all terms from more than one database. * Query::get_terms_begin(): Don't return "" from the TermIterator (happened when the query contained or was Query::MatchAll). * Add QueryParser::FLAG_DEFAULT to make it easier to add flags to those set by default. testsuite: * The testsuite now reports problems detected by valgrind with newer valgrind versions. Drop support for running the testsuite under valgrind < 3.3.0 (well over a year old) as this greatly simplifies the configure tests. * Fix usage message for options which take arguments in --help output from test programs - "-x=foo" doesn't work, the correct syntax is "-x foo". * If comparing MSet percentages fails, report the differing percentages if in verbose mode. * Add test that backends don't truncate total document length to 32 bits. * Disable lockfileumask1 (regression testcase added in 1.0.10) on Cygwin and on OS/2. flint backend: * The configure test for pread() and pwrite() got accidentally disabled in 0.8.4 and we've always been using llseek() followed by read() or write() since then. The configure test is now fixed, and gives a slight speedup (3% measured for searching). * The child process used to implement WritableDatabase locking now changes directory to / so that it doesn't block unmounting of any partitions and closes any open file descriptors which aren't relating to locking so that if those files are closed by our parent and deleted the disk space gets released right away. * We now reuse the same zlib zstream structures rather than using a fresh one for each operation. This doesn't make a measurable difference in our own tests on Linux but reportedly is measurably faster on some systems. (ticket #325) quartz backend: * The pread()/pwrite() fix also speeds up quartz. remote backend: * Avoid copying Query::Internal objects needlessly when unserialising Query objects. inmemory backend: * Store the (non-normalised) document lengths as Xapian::termcount (unsigned int) rather than Xapian::doclength (double) which saves 4 bytes per document. build system: * configure: The output of g++ --version changed format (again) with GCC 4.3 which meant configure got "g++" for the version. Instead use the (hopefully) more robust technique of using g++ -E to pull out __GNUC__ and __GNUC_MINOR__. documentation: * API documentation: + WritableDatabase::flush() can't throw DatabaseLockError. + WritableDatabase's constructor can throw at least DatabaseCorruptError or DatabaseLockError. + Document how to get all matches from Enquire::get_mset(). + Other minor improvements. * docs/sorting.html: Clarify meaning. portability: * Fix "#line" directives in generated file queryparser/queryparser_internal.cc to give a relative path - previously they had a full path when generated by a VPATH build (as release tarballs are), and this confused GCC 2.95 and depcomp. * Fix for compiling with Sun's compiler (untested as we no longer have access to it). Xapian-core 1.0.10 (2008-12-23): API: * Composing an OP_NEAR query with two non-term subqueries now throws UnimplementedError instead of AssertionError (in a --enable-assertions build) or leading to unexpected results (otherwise). This partly addresses bug#201. * Using a MultiValueSorter with no values set no longer causes a hang or segmentation fault (but it is still rather pointless!) matcher: * If we're using values for sorting and for another purpose, cache the Document::Internal object created to get the value for sorting, like we do between other uses. flint backend: * If the disk became full while flushing database changes to disk, the WritableDatabase object would throw a DatabaseError exception but be left in an inconsistent state such that further use could lead to the database on disk ending up in a "corrupt" state (theoretically fixable, but no tool to fix such a database exists). Now we try to ensure that the object is left in a consistent state, but if doing so throws a further exception, we put the WritableDatabase object in a "closed" state such that further attempts to use it throw an exception. * Create the lockfile "flintlock" with permissions 0666 so that the umask is honoured just like we do for the other files (previously we used 0600). Previously it wasn't possible to lock a database for update if it was owned by another user, even if you otherwise had sufficient permissions via "group" or "other". * Fix garbled exception message when a base file can't be reread. quartz backend: * Fix garbled exception message when a base file can't be reread. remote backend: * xapian-tcpsrv and xapian-progsrv now accept -w as a short form of --writable, as was always intended. build system: * This release now uses newer versions of the autotools (autoconf 2.62 -> 2.63; automake 1.10.1 -> 1.10.2). documentation: * INSTALL: Add new paragraphs about HP's aCC and IRIX (adapted from footnotes in PLATFORMS). * PLATFORMS: HP testdrive has been shut down, so all mark all those machines as "no longer available". Update atreus' build report to 1.0.10. * docs/queryparser.html: Add link to valueranges.html. examples: * delve: Add missing "and" to --help output. Report termfreq and collection freq for each term we're asked about. portability: * Fix to build with GCC 4.4 snapshot. Xapian-core 1.0.9 (2008-10-31): API: * Database::get_spelling_suggestion() is now faster (15% speed up for parsing queries with FLAG_SPELLING_CORRECTION set in a test on real world data). * Fix OP_ELITE_SET segmentation fault due to excess floating point precision on x86 Linux (and possibly other platforms). * Database::allterms_begin() over multiple databases now gives a TermIterator with operations O(log(n)) rather than potentially O(n) in the number of databases. * Add new Database methods metadata_keys_begin() and metadata_keys_end() to allow the complete list of metadata in a database to be retrieved (this API addition is needed so that copydatabase can copy database metadata). testsuite: * Remove the cached test databases before running the testsuite. * apitest: Fix cursordelbug1 to work on Microsoft Windows (bug#301). * apitest,queryparsertest: Skip tests which fail because the timer granularity is too coarse to measure how long the test took. In practice, this is only an issue on Microsoft Windows (bug#300 and bug#308). matcher: * Adjust percent cutoff calculations in the matcher in a way which corresponds to the change to percentage calculations made in 1.0.7 to allow for excess precision. * Query::MatchAll no longer gives match results ranked by increasing document length. flint backend: * xapian-compact: Fix crash while compacting spelling table for a single database when built with MSVC, and probably other platforms, though Linux got lucky and happened to work (bug#305). build system: * configure: Disable -Wconversion for now - it's not useful for older GCC and is buggy in GCC 4.3. * configure: Set -Wstrict-overflow to 1 instead of 5, to avoid unreasonable warnings under GCC 4.3. documentation: * Minor improvements to API documentation, including documenting the XAPIAN_FLUSH_THRESHOLD environmental variable in WriteableDatabase::flush() (bug#306). * valueranges.html: Fix typos in example code, and drop superfluous empty destructor from ValueRangeProcessor subclass. * HACKING: Several improvements. examples: * copydatabase: Also copy user metadata. Xapian-core 1.0.8 (2008-09-04): API: * Fix output of RSet::get_description testsuite: * Report subtotals per backend, rather than per testgroup per backend to make the output easier to read. flint backend: * Fix WritableDatabase::add_document() and replace_document() not to be O(n*n) in the number of values in the new document. * Fix handling of a table created lazily after the database has had commits, and which is then cursored while still in sequential mode. * Fix failure to remove all the Btree entries in some cases when all the postings for a term are removed. (bug#287) * xapian-inspect: Show the help message on start-up. Correct the documented alias for next from ' ' to ''. Avoid reading outside of input string when it is empty. (bug#286) quartz backend: * Backport fix from flint for WritableDatabase::add_document() and replace_document() not to be O(n*n) in the number of values in the new document. build system: * configure: Report bug report URL in --help output. * xapian-config: Report bug report URL in --help output. * configure: Fix deprecation error for --enable-debug=full to say to instead use '--enable-assertions --enable-log' not '--enable-debug --enable-log'. documentation: * valueranges.html: Expand on some sections. examples: * quest: Fix to catch QueryParserError instead of const char * which QueryParser threw in Xapian < 1.0.0. * copydatabase: Use C++ forms of C headers. Only treat '\' as a directory separator on platforms where it is. Update counter every 13 counting up to the end so that the digits all "rotate" and the counter ends up on the exact total. portability: * Eliminate literal top-bit-set characters in testsuite source code. Xapian-core 1.0.7 (2008-07-15): API: * OP_VALUE_RANGE, OP_VALUE_GE, and OP_VALUE_LE: + If there were gaps in the document id numbering, these operators could return document ids which weren't present in the database. This has been fixed. + These operators are now more efficient when there are a lot of "missing" document ids (bug#270). + Optimise Query(OP_VALUE_GE, , "") to Query::MatchAll. * Xapian::QueryParser: + QueryParser now stops parsing immediately when it hits a syntax error. This doesn't change behaviour, but does mean failing to parse queries is now more efficient. + Cases of O(N*N) behaviour have been fixed. * Xapian::Stem now recognises "nl" as an alias for "dutch" (debian bug 484458). * Setting sort by value was being ignored by a Xapian::Enquire object which had previously had a Xapian::Sorter set (bug#256). testsuite: * Improved test coverage in a few places. matcher: * When using a MatchDecider, we weren't reducing matches_lower_bound unless all the potential results were retrieved, which led to the lower bound being too high in some such cases. * We now track how many documents were tested by a MatchDecider and how many of those it rejected, and set matches_estimated based on this rate. Also, matches_upper_bound is reduced by the number of rejected documents. * Fixed matches_upper_bound in some cases when collapsing and using a MatchDecider. * Fixed matches_lower_bound when collapsing and using a percentage cutoff. * When using two or more of a MatchDecider, collapsing, or a percentage cutoff, we now only round the scaled estimate once, and we also round it to the nearest rather than always rounding down. Hopefully this should improve the estimate a little in such cases. * Fix problem on x86 with the top match getting 99% rather than 100% (caused by excess precision in an intermediate value). flint backend: * If Database::reopen() is called and the database revision on disk hasn't changed, then do as little work as possible. Even if it has changed, don't bother to recheck the version file (bug#261). * xapian-compact: + Fix check for user metadata key to not match other key types we may add in the future. When compacting, we can't assume how we should handle them. + If the same user metadata key is present in more than one source database with different tag values, issue a warning and copy an arbitrary tag value. + Fix potential SEGV when compacting database(s) with user metadata but no postings. + In error message, refer to "iamflint" as the "version file", not the "meta file". * xapian-inspect: + Print top-bit-set characters as escaped hex forms as they often won't be valid UTF-8 sequences. + If we're passed a database directory rather than a single table, issue a special error message since this is an obvious mistake for users to make. * Fix cursor handling for a modified table which has previously only had sequential updates which usually manifested as zlib errors (bug#259). quartz backend: * Fix cursor handling for a modified table which has previously only had sequential updates which usually manifested as incorrect data being returned (bug#259). * Calling skip_to() as the first operation on an all-documents PostingIterator now works correctly. remote backend: * Improve performance of matches with multiple databases at least one of which is remote, and when the top hit is from a remote database (bug#279). * When remote protocol version doesn't match, the error message displayed now shows the minor version number supplied by the server correctly. * We now wait for the connection to close after sending MSG_SHUTDOWN for a WritableDatabase, which ensures that changes have been written to disk and the lock released before the WritableDatabase destructor returns (as is the case with a local database). * We no longer ever send MSG_SHUTDOWN for a read-only Database - just closing the connection is enough (and is protocol compatible). inmemory backend: * Fix bug which resulted in the values not being stored correctly when replacing an existing document, or if there are gaps in the document id numbering. build system: * This release now uses newer versions of the autotools (autoconf 2.61 -> 2.62; automake 1.10 -> 1.10.1; libtool 1.5.24 -> 1.5.26). The newer autoconf reportedly results in a faster configure script, and warns about use of unrecognised configure options. * Fix configure to recognise --enable-log=profile and fix build problems when this is enabled. * "make up" in the "tests" subdirectory now does "make" in the top-level. * Fix "make distcheck" by using dist-hook to install generated files from either srcdir or builddir, with the appropriate dependency to generate them automatically in maintainer mode builds. documentation: * intro_ir.html: Improve wording a bit. * The documentation now links to trac instead of bugzilla. For links to the main website, we now prefer xapian.org to www.xapian.org. * Doxygen-generated API documentation: + Improved documentation in several places. + The helper macro XAPIAN_VISIBILITY_DEFAULT no longer appears in the output. + Header and directory relationship graphs are no longer generated as they aren't actually informative here. * HACKING: Numerous updates and improvements. examples: * quest: Output get_description() of the parsed query. portability: * Fix build with GCC 2.95.3. * Fix build with GCC 4.3. * Newer libtool features improved support for Mac OS X Leopard and added support for AIX 6.1. debug code: * Database::get_spelling_suggestion() now debug logs with category APICALL rather than SPELLING, for consistency with all other API methods. * Added APICALL logging to a few Database methods which didn't have it. * Remove debug log tracing from get_description() methods since logging for other methods calls get_description() methods on parameters, so logging these calls just makes for more confusing debug logs. A get_description() method should have no side-effects so it's not very interesting even when explicitly called by the user. Xapian-core 1.0.6 (2008-03-17): API: * Add new query operators OP_VALUE_LE and OP_VALUE_GE which perform "single ended" range checks, and a corresponding new Query constructor. * Add Unicode::toupper() to complement Unicode::tolower(). * Xapian::Stem has been further optimised - stemtest now runs ~2.5% faster. testsuite: * tests/runtest: Fixed to handle test programs with a ".exe" extension. * tests/queryparsertest: Add a couple more testcases which already work to improve test coverage. * tests/apitest: Add caseconvert1 testcase to test Unicode::tolower() and Unicode::toupper(). flint backend: * xapian-check: Fix not to report an error for a database containing no postings but some user metadata. * Update the base files atomically to avoid problems with reading processes finding partially written ones. * Create lazy tables with the correct revision to avoid producing a database which we later report as "corrupt" (bug#232). * xapian-compact: Fix compaction for databases which contain user metadata keys. quartz backend: * Update the base files atomically to avoid problems with reading processes finding partially written ones. remote backend: * The addition of OP_VALUE_LE and OP_VALUE_GE required an update to the Query serialisation, which required a minor remote protocol version bump. * Fix to actually set the writing half as the connection as non-blocking when a timeout is specified. This would have prevented timeouts from operating correctly in some situations. build system: * configure: GCC warning flag overhaul: Stop passing "-Wno-multichar" since any multi-character character literal is bound to be a typo (I believe we were only passing it after misinterpreting its sense!) Pass "-Wformat-security", and "-Wconversion" for all GCC versions. Add "-Winit-self" and "-Wstrict-overflow=5" for GCC >= 4.2. The latter might prove too aggressive, but seems reasonable so far. Fix some minor niggles revealed by "-Wconversion" and "-Wstrict-overflow=5". * Add XAPIAN_NORETURN() annotations to functions and non-virtual methods which don't return. documentation: * docs/intro_ir.html: Briefly mention how pure boolean retrieval is supported. * docs/valueranges.html: Fix example of using multiple VRPs to come out as a "program listing". * include/xapian/queryparser.h: Fix incorrect example in doccomment. * docs/quickstart.html: Remove information covered by INSTALL since there's no good reason to repeat it and two copies just risks one getting out of date (as has happened here!) * docs/quickstart.html: Fix very out of date reference to MSet::items (bug#237). * PLATFORMS: Remove reports for 0.8.x as they're too old to be interesting. Separate out 0.9.x reports. Add Solaris 9 and 10 success reports from James Aylett. Update from Debian buildd logs. portability: * Now builds on OS/2, thanks to a patch by Yuri Dario. * Fix testsuite to build on mingw (broken by changes in 1.0.5). debug code: * Fix --enable-assertions build, broken by changes in 1.0.5. Xapian-core 1.0.5 (2007-12-21): API: * More sophisticated sorting of results is now possible by defining a functor subclassing Xapian::Sorter (bug#100). * Xapian::Enquire now provides a public copy constructor and assignment operator (bug#219). * Xapian::Document::values_begin() didn't ensure that values had been read when working on a Document read from a database. However, values_end() did (and so did values_count()) so this wasn't generally a problem in practice. * Xapian::PostingIterator::skip_to() now works correctly when running over multiple databases. * Xapian::Database::postlist_begin() no longer adds a "MultiPostList" wrapper for the common case when there's only one subdatabase. * Xapian::TradWeight now avoids division by zero in the (rare) situation of the average document length being zero (which can only happen if all documents are empty or only have terms with wdf 0). * Calling Xapian::WritableDatabase methods when we don't have exactly one subdatabase now throws InvalidOperationError. testsuite: * apitest: + Testcases now describe the conditions they need to run, and are automatically collated by a Perl script. This makes it significantly easier to add a new testcase. + The test harness's "BackendManager" has been overhauled to allow cleaner implementations of testcases which are currently hard to write cleanly, and to make it easier to add new backend settings. + Add a "multi" backend setting which runs suitable tests over two subdatabases combined. There's a corresponding new make target "check-multi". + Add more feature tests of document values. + sortrel1 now runs for inmemory too. + Add simple feature test for TradWeight being used to run a query. + Fix spell3 to work on Microsoft Windows (bug#177). + API classes are now tested to check they have copy constructors and assignment operators, and also that most have a default constructor. + quartztest testcases adddoc2 and adddoc3 have been reworked as apitest testcases adddoc5 and adddoc6, which run for other backends. + stubdb1 now explicitly creates the database it needs - generally this bug didn't manifest because an earlier test has already created it. * queryparsertest: Add feature tests to check that ':' is being inserted between prefix and term when it should be. * Fix extracting of valgrind error messages in the test harness. * tests/valgrind.supp: Add more variants of the zlib suppressions. matcher: * Xapian::Enquire: When the "first" parameter to get_mset() is non-zero, avoid copying all the wanted items after performing the match. * Fix bug in handling a pure boolean match over more than one database under set_docid_order(ASCENDING) - we used to exit early which isn't correct. * When collapsing on a value, give a better lower bound on the number of matches by keeping track of the number of empty collapse values seen. * Xapian::BM25Weight: Fix bug when k2 is non-zero: a non-initialised value influenced the weight calculations. By default k2 is zero, so this bug probably won't have affected most users. * The mechanism used to collate term statistics across multiple databases has been greatly simplified (bug#45). flint backend: * xapian-check: + Update to handle flint databases produced by Xapian 1.0.3 and later. + Fix not to go into an infinite loop if certain checks fail. quartz backend: * quartzcompact: Fix equality testing of C strings to use strcmp() rather than '=='! In practice, using '==' often gives the desired effect due to pooling of constant strings, but this may have resulted in a bug on some platforms. remote backend: * If we're doing a match with only one database which is remote then just return the unserialised MSet from the remote match. This requires an update to the MSet serialisation, which requires a minor remote protocol version bump. build system: * XO_LIB_XAPIAN now hooks LT_INIT as well as AC_PROG_LIBTOOL and AM_PROG_LIBTOOL. * Distribute preautoreconf, dir_contents, docs/dir_contents and tests/dir_contents. * Fix preautoreconf to correctly handle all the sources passed to doxygen to create the collated internal source documentation, and to work in a VPATH build. documentation: * sorting.html: New document on the topic of sorting match results. * HACKING,admin_notes.html,bm25.html,glossary.html,intro_ir.html,overview.html, quickstart.html,scalability.html,termgenerator,html,synonyms.html: Assorted minor improvements. * valueranges.html: State explicitly that Xapian::sortable_serialise() is used to encode values at index time, and give an example of how it is called. * API documentation: + Clarify get_wdf() versus get_termfreq(). + We now use pngcrush to reduce the size of PNG files in the HTML version. + The HTML version no longer includes various intermediate files which doxygen generates. + Hide the v102 namespace from Doxygen as it isn't user visible. + Stop describing get_description() as an "Introspection method", as this doesn't help to explain what it does, and get_description() doesn't really fall under common formal definitions of "introspection". * index.html: Add a list of documents on particular topics and include links to previously unlinked-to documents. Weed down the top navigation bar which had grown to unwieldy length. * PLATFORMS: Update for Debian buildds. * Improve documentation comment for Document::termlist_count(). * admin_notes.html: Note that this document is up-to-date for 1.0.5. * INSTALL: zlib 1.2.0 apparently fixes a memory leak in deflateInit2(), which we use, so that's another reason to prefer 1.2.x. portability: * Add explicit includes of C headers needed to build with the latest snapshots of GCC 4.3. Fix new warnings. * xapian-config: On platforms which we know don't need explicit dependencies, --ltlibs now gives the same output as --libs. * The minimum supported GCC version is now 2.95.3 (rather than 2.95) as 2.95.3 added support for '#include ' which means we no longer need to maintain our own version. * Fix build with SGI's compiler on IRIX. * Fix or suppress some MSVC warnings. debug code: * Remove incorrect assertion in MultiAndPostList (bug#209). * Fix build when configured with "--enable-log --disable-assertions". Xapian-core 1.0.4 (2007-10-30): API: * Query: + Add OP_SCALE_WEIGHT operator (and a corresponding constructor which takes a single subquery and a parameter of type "double"). This multiplies the weights from the subquery by the parameter, allowing adjustment of the importance of parts of the query tree. + Deprecate the essentially useless constructor Query(Query::op, Query). * QueryParser: + A field prefix can now be set to expand to more than one term prefix. Similarly, multiple term prefixes can now be applied by default. This is done by calling QueryParser::add_boolean_prefix() or QueryParser::add_prefix() more than once with the same field name but a different term prefix (previously subsequent calls with the same field name had no effect). + Trying to set the same field as probabilistic and boolean now throws InvalidOperationError. + Fix parsing of `term1 site:example.org term2', broken by changes in 1.0.2. + Drop special treatment for unmatched ')' at the start of the query, as it seems rather arbitrary and not particularly useful and was causing us to parse `(site:example.org) -term' incorrectly. + The QueryParser now generates pure boolean Query objects for strings such as `site:example.org' by applying OP_SCALE_WEIGHT with a factor of 0.0. + Fix handling of `"quoted phrase" +term' and `"quoted phrase" -term'. + Fix handling of `site:example.org -term'. + Fix problem with spelling correction of hyphenated terms (or other terms joined with phrase generators): the position of the start of the term wasn't being reset for the second term in the generated phrase, resulting in out of bounds errors when substituting the new value in the corrected query string. + The parser stack is now a std::vector<> rather than a fixed size, so it will typically use less memory, and can't hit the fixed limit. + Fix handling of STEM_ALL and update the documentation comment for QueryParser::set_stemming_strategy() to explain how it works clearly. * PostingIterator: positionlist_begin() and get_wdf() should now always throw InvalidOperationError where they aren't meaningful (before in some cases UnimplementedError was thrown). testsuite: * Add tests for new features. * Add another valgrind suppression for a slightly different error from zlib in Ubuntu gutsy. * Remove quartztest's test_postlist1 and test_postlist2, replacing the coverage lost by extending and adding tests which work with other backends as well. * If a test throws a subclass of std::exception, the test harness now reports the class name and the extra information returned by std::exception's what() method. matcher: * Several performance improvements have been made, mainly to the handling of OP_AND and related operations (OP_FILTER, OP_NEAR, and OP_PHRASE). In combination, these are likely to speed up searching significantly for most users - in tests on real world data we've seen savings of 15-55% in search times). These improvements are: + OP_AND of 3 or more sub-queries is now processed more efficiently. + Sub-queries from adjacent OP_AND, OP_FILTER, OP_NEAR, and OP_PHRASE are now combined into a single multi-way OP_AND operation, and the filters which implement the near/phrase restrictions are hoisted above this so they need to check fewer documents (bug#23). + If an OP_OR or OP_AND_MAYBE decays to OP_AND, we now ensure that the less frequent sub-query is on the left, which OP_AND is optimised to expect. * When the Enquire::get_mset() parameter checkatleast is set, and we're sorting by relevance with forward ordering by docid, and the query is pure boolean, the matcher was deciding it was done before the checkatleast requirement was satisfied. Then the adjustments made to the estimated and max statistics based on checkatleast meant the results claimed there were exactly msize results. This bug has now been fixed. * Queries involving an OP_VALUE_RANGE filter now run around 3.5 times faster (bug#164). * The calculations behind MSet::get_matches_estimated() were always rounding down fractions, but now round to the nearest integer. Due to cumulative rounding, this could mean that the estimate is now a few documents higher in some cases (and hopefully a better estimate). * Implement explicit swap() methods for internal classes MSetItem and ESetItem which should make the final sort of the MSet and ESet a little more efficient. flint backend: * Fixed a bug introduced in 1.0.3 - trying to open a flint database for reading no longer fails if it isn't writable. * We no longer use member function pointers in the Btree implementation which seems to speed up searching a little. remote backend: * The remote protocol minor version has been increased (to accommodate OP_SCALE_WEIGHT). If you are upgrading a live system which uses the remote backend, upgrade the servers before the clients. build system: * Added macro machinery to allow branch prediction hints to be specified and used by compilers which support this (current GCC and Intel C++). * In a developer build, look for rst2html.py if rst2html isn't found as some Linux distros have it installed under with an extension. documentation: * In the API documentation, explicitly note that Database::get_metadata() returns an empty string when the backend doesn't support user-specified metadata, and that WritableDatabase::set_metadata() throws UnimplementedError in this case. Also describe the current behaviour with multidatabases. * README: Remove the ancient history lesson - this material is better left to the history page on the website. * deprecation.html: + Deprecate the non-pythonic iterators in favour of the pythonic ones. + Move "Stem::stem_word(word)" in the bindings to the right section (it was done in 1.0.0, as already indicated). + Improve formatting. * When running rst2html, using "--verbose" was causing "info" messages to be included in the HTML output, so drop this option and really fix this issue (which was thought to have been fixed by changes in 1.0.3). * install.html: Reworked - this document now concentrates on giving a brief overview of building which should be suitable for most common cases, and defers to the INSTALL document in each tarball for more details. * PLATFORMS: Update from tinderbox and buildbot. * remote.html: xapian-tcpsrv has been able to handle concurrent read access since 0.3.1 (7 years ago) so update the very out-of-date information here. Also, note that some newer features aren't supported by the remote backend yet. * HACKING: Note specifically that std::list::size() is O(n) for GCC. * intro_ir.html: Add link to the forthcoming book "Introduction to Information Retrieval", which can be read online. * scalability.html: Update size of gmane. * quartzdesign.html: Note that Quartz is now deprecated. debug code: * The debug assertion code has been rewritten from scratch to be cleaner and pull in fewer other headers. Xapian-core 1.0.3 (2007-09-28): API: * Add support for user specified metadata (bug#143). Currently supported by the flint and inmemory backends. * Deprecate Enquire::register_match_decider() which has always been a no-op. * Improve the lower bound on the number of matching documents for an AND query - if the sum of the lower bounds for the two sides is greater than the number of documents in the database, then some of them must have both terms. * Spelling correction: Fix off-by-one error in loop bounds when initialising (bug#194). * If the check_at_least parameter to Enquire::get_mset() is used, but there aren't that many results, then MSet::get_matches_lower_bound() and MSet::get_matches_upper_bound() weren't always reported as equal - this bug is now fixed. * When sorting by value, and using the check_at_least parameter to Enquire::get_mset(), some potential matches weren't being counted. * Failing to create a flint or quartz database because we couldn't create the directory for it now throws DatabaseCreateError not DatabaseOpeningError. testsuite: * Fix display of valgrind output when a test fails because valgrind detected a problem. * Add another version of valgrind suppression for the zlib end condition check as this gives a different backtrace for zlib in Ubuntu gutsy. flint backend: * The Flint database format has been extended to support user metadata, and each termlist entry is now a byte shorter (before compression). As a result, Xapian 1.0.2 and earlier won't be able to read Xapian 1.0.3 databases. However, Xapian 1.0.3 can read older databases. If you open an older flint database for writing with Xapian 1.0.3, it will be upgraded such that it cannot then be read by Xapian 1.0.2 and earlier. * Zlib compression wasn't being used for the spelling or synonym tables (due to a typo - Z_DEFAULT_COMPRESSION where it should be Z_DEFAULT_STRATEGY). * xapian-check: Allow "db/record." and "db/record.DB" as arguments. * Fix "key too long" exception message by substituting FLINT_BTREE_MAX_KEY_LEN with its numeric value. * Assorted minor efficiency improvements. * If we reach the flush threshold during a transaction, we now write out the postlist changes, but don't actually commit them. * Check length of new terms is at most 245 bytes for flint in add_document() and replace_document() so that the API user gets an error there rather than when flush() is called (explicitly or implicitly). Fixes bug#44. * Flint used to read the value of the environmental variable XAPIAN_FLUSH_THRESHOLD when the first WritableDatabase was opened and would then cache this value. However the program using Xapian may have changed it, so we now reread it each time a WritableDatabase is opened. * Implement TermIterator::positionlist_count() for the flint backend. remote backend: * Fix the result of MSet::get_matches_lower_bound() when using the check_at_least parameter to get_mset(). inmemory backend: * Implement TermIterator::positionlist_count() for the inmemory backend. build system: * xapian-config: We always need to include dependency_libs in the output of `xapian-config --libs` if shared libraries are disabled. * Distribution tarballs are now in the POSIX "ustar" format. This supports pathnames longer than 99 characters (which we now have a few instances of in the doxygen generated documentation) and also results in a distribution tarball that is about half the size! This format should be readable by any tar program in current use - if your tar program doesn't support it, we'd like to know (but note that the GNU tar tarball is smaller than the size reduction in the xapian-core tarball...) * configure no longer generates msvc/version.h - this is now entirely handled by the MSVC-specific makefiles. documentation: * Add a glossary. * docs/stemming.html: Reorder the initial paragraphs so we actually answer the question "What is a stemming algorithm?" up front. * When running rst2html, use "--exit-status=warning" rather than "--strict". The former actually gives a non-zero exit status for a warning or worse, while the former doesn't, but does include any "info" messages in the output HTML. * docs/deprecation.rst: Add "Database::positionlist_begin() throwing RangeError and DocNotFoundError". * valueranges.rst: Correct out-of-date reference to float_to_string. * HACKING: Document a few more "coding standards". * PLATFORMS: Updated. * docs/overview.html: Restore HTML header accidentally deleted in November 2006. * Fix several typos. portability: * Add missing instances of "#include " to fix compilation with recent GCC 4.3 snapshots. * Fix some warnings for various compilers and platforms. Xapian-core 1.0.2 (2007-07-05): API: * Xapian now offers spelling correction, based on a dynamically maintained list of spelling "target" words. This is currently supported by the flint backend, and works when searching multiple databases. * Xapian now offers search-time synonym expansion, based on an externally provided synonym dictionary. This is currently supported by the flint backend, and works when searching multiple databases. * TermGenerator: now offers support for generating spelling correction data. * QueryParser: + New flag FLAG_SPELLING_CORRECTION to enable spelling correction, and a new method, "get_corrected_query_string()" to get the spelling corrected query string. + New flags have been added to allow the new synonym expansion feature to be enabled and controlled. Synonym expansion can either be automatic, or only for terms explicitly indicated in the query string by the new "~" operator. + The precedence of the boolean operators has been adjusted to match their usual precedence in mathematics and programming languages. "NOT" now binds as tightly as "AND" (previously "AND NOT" would bind like "AND", but just "NOT" would bind like "OR"!) Also "XOR" now binds more tightly than "OR", but less tightly than "AND" (previously it bound just like "OR"). + '+' and '-' have been fixed to work on bracketed subexpressions as documented. + If the stemmer is "none", no longer put a Z prefix on terms; this now matches the output of TermGenerator. * Add new Xapian::sortable_serialise() and Xapian::sortable_unserialise() functions which serialise and unserialise numbers (currently only doubles) to a string representation which sorts in numeric order. Small integers have a short representation. * NumberValueRangeProcessor has been changed to work usefully. Previously the numbers had to be the same length; now numbers are serialised to strings such that a string sort on the string orders the numbers correctly. Negative and floating point numbers are also supported now. The old NumberValueRangeProcessor is still present in the library to preserve ABI compatibility, but code linking against 1.0.2 or later will pick up the new implementation, which really lives in a sub-namespace. * Documents now have a get_docid() method, to get the document ID from the database they came from. * Add support for a new type of match decider, called a "matchspy". Unlike the old deciders, this will reliably be tested on every candidate document, so can be used to tally statistics on them. * Fixed a segfault when getting a description for a MatchNothing query joined with AND_NOT (bug #176). * Header files have been tidied up to remove some unnecessary includes. Applications using "#include " will not be affected. We don't intend to support direct inclusion of individual header files from the xapian directory, but if you do that, you may have to update you code. testsuite: * Feature tests added for all new features. * Improved test coverage in queryparsertest. Some tests in queryparsertest now use flint databases, so the test now ensures that the .flint subdirectory exists. * The test harness no longer creates /log for flint (flint doesn't create a log like quartz does). * apitest: "-bremote" must now be "-bremoteprog" (to better match "-bremotetcp"); "-bvoid" must now be "-bnone" (to better describe not using a database backend). * To complement "make check-flint", "make check-quartz", and "make check-remote", you can now run tests for the remotetcp backend with "make check-remotetcp", for the remoteprog backend with "make check-remoteprog", for the inmemory backend with "make check-inmemory", and tests not requiring a backend with "make check-none". * Several extra tests of the check_at_least parameter supplied to get_mset() were added. * Fix memory leak and fd leak in remotetcp handling, so apitest now passes under valgrind. * quartztest: no longer test QuartzPostList::get_collection_freq(), which has been removed. * Add regression test emptyquery2 for bug #176. * Add regression test matchall1 for bug with MatchAll queries. * Enhanced test coverage of match functor, to check that it returns all matching documents. matcher: * Fix bug when check_at_least was supplied - the matches after the requested MSet size were being returned to the user. The parameter is also now handled in a more efficient way - no extra memory is required (previously, extra memory proportional to the value of check_at_least was required). * Fix bug which used incorrect statistics, and caused assertion failures, when performing a search using a MatchAll query. * Optimisation for single term queries: we don't need to look at the top document's termlist to determine that it matches all the query terms. flint backend: * The value and position tables are now only created if there is anything to add to them. So if you never use document values, there's no value.DB, value.baseA, or value.baseB. This means the table doesn't need to be opened for searching (saving a file handle and a number of syscalls) and when flushing changes, we don't need to update baseA/baseB just to keep the revisions in step. The flint database version has been increased, but the new code will happily open and read/update flint databases from Xapian 1.0.0 and 1.0.1. Xapian 1.0.2 flint databases can't be read by Xapian 1.0.1 or earlier though. * Two new optional tables are now supported: "spelling", which is used to store information for spelling correction, and "synonym", which is used to store synonym information. * xapian-compact: Now compacts and merges spelling and synonym tables. Also has a new option "--no-renumber" to preserve document ids from source databases. * xapian-check: Now checks the spelling and synonym tables (only the Btree structure is currently checked, not the information inside). * Database::term_exists(), Database::get_termfreq(), and Database::get_collection_freq() are now slightly more efficient for flint databases. * New utility 'xapian-inspect' which allowing interactive inspection of key/tag pairs in a flint Btree. Useful for development and debugging, and an approximate equivalent to quartzdump. * WritableDatabase::delete_document() no longer cancels pending changes if the document doesn't exist. * Fix handling of exceptions during commit - previously, this could result in tables getting out-of-sync, perhaps even resulting in a corrupt database. * Optimise iteration of all documents in the case where all the document IDs up to lastdocid are used; in this case, we no longer need to access disk to get the document IDs. quartz backend: * WritableDatabase::delete_document() no longer cancels pending changes if the document doesn't exist. * We no longer create a postlist just to find the termfreq or collection frequency. remote backend: * Calling WritableDatabase::delete_document() on a non-existent document now correctly propagates DocNotFoundError. * The minor remote protocol version has increased (to fix the previous issue). You should be able to cleanly upgrade a live system by upgrading servers first and then clients. * progclient: Reopen stderr on the child process to /dev/null rather than closing it. This fixes apitest with the remoteprog backend to pass when run under valgrind (it failed in this case in 1.0.0 and 1.0.1). It probably has no effect otherwise. * check_at_least is now passed to the remote server to reduce the work needed to produce the match, and the serialised size of the returned MSet. inmemory backend: * Bug fix: using replace_document() to add a document with a specific document id above the highest currently used would create empty documents for all document ids in between. build system: * Work around an apparent bug in automake which causes the entries in .libs subdirectories generated for targets of bin_PROGRAMS not to be removed on make clean. This was causing make distcheck to fail. * Snapshots and releases are now bootstrapped with automake 1.10, and libtool 1.5.24. * HTML documentation generated from RST files is now installed. documentation: * The API documentation is now generated with Doxygen 1.5.2, which fixes the missing docs for Xapian::Query. * Ship and install internals.html. * Generating the doxygen-collated documentation of the library internals (with "make doxygen_source_docs") now only tries to generate an HTML version. The PDF version kept exceeding TeX limits, and HTML is a more useful format for this anyway. * API docs for Xapian::QueryParser now make it clear that the default value for the stemming strategy is STEM_NONE. * API docs now describe the NumberValueRangeProcessor more clearly. * Several typo fixes and assorted wording improvements. * queryparser.html: Mention "AND NOT" as an alternative way to write "NOT", and document synonym expansion. * admin_notes.html: Updated for changes in this release, and corrected a few minor errors. * spelling.rst: New file, documenting the spelling correction feature. * synonyms.rst: New file, documenting the synonyms expansion feature. * valueranges.rst: The NumberValueRangeProcessor is now documented. * HACKING: Mention new libtool, and more details about preferring pre-increment. Also add a note about 2 space indentation of protection level declarations in classes. * INSTALL: note that zlib must be installed before you can build. examples: * copydatabase: Now copies synonym and spelling data. Also, fix a cosmetic bug with progress output when a specified database directory has a trailing slash. portability: * Fix to build on with OpenBSD's zlib (xapian-core 1.0.0 and 1.0.1 didn't). * Fixed to build with older zlib such as zlib 1.1.5 which Solaris apparently uses (xapian-core 1.0.0 and 1.0.1 didn't). However, we recommend using zlib 1.2.x as decompressing is apparently about 20% faster. * msvc/version.h.in: Generated version.h for MSVC build no longer has the remote backend marked as disabled. * Fix warnings from Intel's C++ compiler. * Fixes for compilation with gcc-2.95 and GCC 4.3 snapshots. packaging: * RPMs: + Rename xapian.spec to xapian-core.spec to match tarball name. + Append the user name to BuildRoot. debug code: * Better debug logging from the queryparser internals. Xapian-core 1.0.1 (2007-06-11): API: * Xapian::Error: + Make Error::error_string member std::string rather than char * to avoid problems with double free() with copied Error objects. Unfortunately this mean an incompatible ABI change which we had hoped to avoid until 1.1.0, but in this case there didn't seem to be a sane way to fix the problem without an ABI change. + Error::get_description() now converts my_errno to error_string if it hasn't been already rather than not including any error description in this case. + Add new method "get_description()" to get a string describing the error object. This is used in various examples and scripts, improving their error reporting. * Xapian::Database: Add new form of allterms_begin() and allterms_end() which allow iterating of all terms with a particular prefix. This is easier to use than checking the end condition yourself, and is more efficiently implemented for the remote backend (fixes bug#153). * Xapian::Enquire: Passing an uninitialised Database object to Enquire will now cause InvalidArgumentError to be thrown, rather than causing a segfault when you call Enquire::get_mset(). If you really want an empty database, you can use Xapian::InMemory::open() to create one. * Xapian::QueryParser: Multiple boolean prefixed terms with the same term prefix are now combined with OR before such groups are combined with AND (bug#157). Multiple value ranges on the same value are handled similarly. * Xapian::Query OP_VALUE_RANGE: Avoid calling db->get_lastdocid() repeatedly as we know the answer won't change - this reduces the run time of a particular test case by 25%. testsuite: * Add test for serialisation of error strings. * Improved output in various situations: + Quote strings in TEST_STRINGS_EQUAL(). + queryparsertest: Use TEST_STRINGS_EQUAL when comparing query descriptions against their expected output, since this makes it much easier to see the differences. + Report whole message for exceptions, rather than a truncated version, in verbose mode. + Make use of Xapian::Error::get_description(), giving better error reports. * queryparsertest: New test of custom ValueRangeProcessor subclass (qp_value_customrange1). * apitest: flintdatabaseformaterror1 and flintdatabaseformaterror2 now use a genuine Xapian 0.9.9 flint database for their tests, and more cases are tested. The two tests have also been split into 3 now. * Fix test harness not to invoke undefined behaviour in cases where a paragraph of test data contains two or fewer characters. * Implement a better fix for the MSVC ifstream issue which was fixed in 1.0.0. This fixes an unintentional side-effect of the previous fix which meant that apitest's consistency1 wasn't working as intended (it now has a regression test to make sure it is testing what we intend). flint backend: * xapian-compact: Don't uncompress and recompress tags when compacting a database. This speeds up xapian-compact rather a lot (by more than 50% in a quick test). * If the docid counter wraps, Flint now throws DatabaseError (fixes bug#152). * Remove the special case error message for pre-0.6 databases since they'll be quartz format (the check is only in flint because this code was taken from quartz). quartz backend: * If the docid counter wraps, Quartz now throws DatabaseError (fixes bug#152). remote backend: * The remote protocol now has a minor version number. If the major version number is the same, a client can work with any server with the same or higher minor version number, which makes upgrading live systems easier for most remote protocol changes - just upgrade the servers first. * When a read-only remote database is closed, the client no longer sends a (totally bogus) MSG_FLUSH to the server, and the reply is also eliminated. This reduces the time taken to close a remote database a little (fixes bug#149). inmemory backend: * skip_to() on an allterms TermIterator from an InMemory Database can no longer move backwards. * An allterms TermIterator now initialises lazily, which can save some work if the first operation is a skip_to() (as it often will be). build system: * Fix VPATH compilation in maintainer mode with gcc-2.95. * Fix multiple target rule for generating the queryparser source files in parallel builds. * Distribute missing stub Makefiles for "bin", "examples", and "include/xapian". documentation: * Document the design flaw with NumberValueRangeProcessor and why it shouldn't be used. * ValueRangeProcessor and subclasses now have API documentation and an overview document. * Expand documentation of value range Query constructor. * Improved API documentation for the TermGenerator class. * docs/deprecation.rst: + Fix copy and paste error - set_sort_forward() should be changed to set_docid_order(). + Improve entry for QueryParserError. * PLATFORMS: Updated from tinderbox. examples: * copydatabase: Rewritten to use the ability to iterate over all the documents in a database. Should be much more efficient for databases with sparsely distributed document IDs. * simpleindex: Rewritten to use the TermGenerator class, which eliminates a lot of non-Xapian related code and is more typical of what a user is likely to want to do. * simplesearch,simpleexpand: Rewritten to use the QueryParser class, which is more typical of what a user is likely to want to do. portability: * xapian-config: Add special case check for host_os matching linux* or k*bsd-gnu since vanilla libtool doesn't correctly probe link_all_deplibs=no for them. packaging: * RPMs: Add "# norootforbuild" comment which SuSE's build scripts look for. Rename "Source0:" to "Source:" as there's only one tarball now. Add gcc-c++ and zlib-devel to "Build-Requires:". * The required automake version has been lowered to 1.8.3, so RPMs can now be built on RHEL 4 and SLES 9. Xapian-core 1.0.0 (2007-05-17): API: * Xapian::Database: + The Database(const std::string &) constructor has been marked as "explicit". Hopefully this won't affect real code, but it's possible. Instead of passing a std::string where a Xapian::Database is expected, you'll now have to explicitly write `Xapian::Database(path)' instead of `path'. + Fixed problem when calling skip_to() on an allterms iterator over multiple databases which could cause a debug assertion in debug builds, and possible misbehaviour in normal builds. * Xapian::Error: + The constructors of Error subclasses which take a `const std::string &' parameter are now explicit. This is very unlikely to affect any real code but if it does, just write `Xapian::Error(msg)' instead of `msg'. + Xapian::Error::get_type() now returns const char* rather than std::string. Generally existing code will just work (only one change was required in Xapian itself) - the simplest change is to write `std::string(e.get_type())' instead of `e.get_type()'. + Previously, the errno value was lost when an error was propagated from a remote server to the client, because errno values aren't portable between platforms. To fix this, Error::get_errno() is now deprecated and you should use Error::get_error_string() instead, which returns a string expanded from the errno value (or other system error code). * Xapian::QueryParser: + Now assumes input text is encoded as UTF-8. + We've made several changes to term generation strategy. Most notably: Unicode support has been added; '_' now counts as a word character; numbers and version numbers are now parsed as a single term; single apostrophes are now included in a term; we now store unstemmed forms of all terms; and we no longer try to "normalise" accents. + parse_query() now throws the new Xapian::Error subclass QueryParserError instead of throwing const char * (bug#101). + Pure NOT queries are now supported (for example, `NOT apples' will match all documents not indexed by the stemmed form of `apples'). You need to enable this feature by passing QueryParser::FLAG_PURE_NOT in flags to QueryParser::parse_query(). + We now clear the stoplist when we parse a new query. + Queries such as `+foo* bar', where no terms in the database match the wildcard `foo*', now match no documents, even if `bar' exists. Handling of `-foo*' has also been fixed. + Now supports wildcarding the last term of a query to provide better support for incremental searching. Enabled by QueryParser::FLAG_PARTIAL. + The default prefix can now be specified to parse_query() to allow parsing of text entry boxes for particular fields. + QueryParser::set_stemming_options() has been deprecated since 0.9.0 and has now been removed. * Xapian::Stem: + Now assumes input text is encoded as UTF-8. + We've updated to the latest version of the Snowball stemmers. This means that a small number of words produce different (and generally better) stems and that some new stemmers are supported: german2 (like german but normalises umlauts), hungarian, kraaij_pohlmann (a different Dutch stemmer), romanian, and turkish. * Xapian::TermGenerator: + New class which generates terms from a piece of text. * Xapian::Enquire: + The Enquire(const Database &) constructor has been marked as "explicit". This probably won't affect real code - certainly no Xapian API methods or functions take an Enquire object as a parameter - but calls to user methods or functions taking an Enquire object could be affected. In such cases, you'll now have to explicitly write `Xapian::Enquire(db)' instead of `db'. + Enquire::get_eset() now produces better results when used with multiple databases - without USE_EXACT_TERMFREQ they should be much more similar to results from an equivalent single database; with USE_EXACT_TERMFREQ they should be identical. + Track the minimum weight required to be considered for the MSet separately from the minimum item which could be considered. Trying to combine the two caused several subtle bugs (bug#86). + Enquire::get_query() is now `const'. Should have no effect on user code. + Enquire::get_mset() now handles the common case of an "exact" phrase search (where the window size is equal to the number of terms) specially. + Enquire::include_query_terms and Enquire::use_exact_termfreq are now deprecated in favour of capitalised versions Enquire::INCLUDE_QUERY_TERMS and Enquire::USE_EXACT_TERMFREQ (for consistency with our other manifest constants, and general C/C++ conventions). * Xapian::RSet: + RSet::contains(MSetIterator) is now `const'. Should have no effect on user code. * Xapian::SimpleStopper::add() now takes `const std::string &' not `const std::string'. Should have no effect on user code. * Xapian::Query: + We now only perform internal validation on a Query object when it's either constructed or changed, to avoid O(n^2) behaviour in some cases. + Xapian::Query::MatchAll (an alias for Query("")) matches all terms in the document (useful for "pure NOT" queries) and Xapian::Query:MatchNothing is now a more memorable alias for Query(). * Instead of explicitly checking that a term exists before opening its postlist, we now do both in one operation, which is more efficient. * MatchDecider::operator() now returns `bool' not `int'. * ExpandDecider::operator() now returns `bool' not `int'. * Xapian::TermIterator::get_termfreq() now throws InvalidOperationError if called on a TermIterator from a freshly created Document (since there's no meaningful term frequency as there's no Database for context). * is no longer available as an externally visible header. It's not been included by since 0.7.0. Instead of using `cout << obj;' use `cout << obj.get_description();'. * New constant Xapian::BAD_VALUENO which is -1 cast to Xapian::valueno. * New Xapian::ValueRangeProcessor hierarchy: DateValueRangeProcessor, NumberValueRangeProcessor, and StringValueRangeProcessor. In conjunction with the new QueryParser::add_valuerangeprocessor() method and the new Query::OP_VALUE_RANGE op these allow you to implement ranges in the query parser, such as `$50..100', `10..20kg', `01/02/2007..03/04/2007'. testsuite: * Many new and improved testcases in various areas. * If a test throws an unknown exception, say so in the test failure message. If it throws std::string, report the first 40 characters (or first line if less than 40 characters) of the string even in non-verbose mode. * Use of valgrind improved: + The test harness now only hooks into valgrind if environment variable XAPIAN_TESTSUITE_VALGRIND is set, which makes it easy to run test programs under valgrind in the normal way. The runtest script sets this automatically. + runtest now passes "--leak-resolution=high" to valgrind to prevent unrelated leak reports related to STL classes from being combined. + configure tests for valgrind improved and streamlined. + New runsrv script to run xapian-tcpsrv and xapian-progsrv. We need to run these under valgrind to avoid issues with excess numerical precision in valgrind's FP handling, but we can use "--tool=none" which is a lot faster than running them under valgrind's default memcheck tool. * The test harness now starts xapian-tcpsrv in a more reliable way - it will try sequentially higher port numbers, rather than failing because a xapian-tcpsrv (or something else) is already using the default port. It also no longer leaks file descriptors (which was causing later tests to fail on some platforms), and if xapian-tcpsrv fails to start, the error message is now reported. * remotetest has been removed and its testcases have either been added to apitest or just removed if redundant with tests already in apitest. * termgentest is a new test program which tests the Xapian::TermGenerator class. * TEST_EQUAL_DOUBLE() now uses a slightly less stringent threshold - DBL_EPSILON is too strict for calculations which include multiple steps. Also, we now use it instead of doubles_are_equal_enough() and weights_are_equal_enough() which try to perform the same job. * New macro TEST_STRINGS_EQUAL() which displays the strings on separate lines so the differences can be clearly seen. * Test programs are now linked with '-no-install' which means that libtool doesn't need to generate shell script wrappers for them on most platforms. * runtest: Now turns on MALLOC_CHECK_ and MALLOC_PERTURB_ for glibc if valgrind isn't being used. * Better support for Microsoft Windows: + test_emptyterm2 no longer tries to delete a database from disk while a WritableDatabase object still exists for it, since this isn't supported under Microsoft Windows. + Fallback handling when srcdir isn't specified how takes into account .exe extensions and different path separators. flint backend: * Flint is now the default backend. * xapian-check: New program which performs consistency checks on a flint database or table. * xapian-compact: Now prunes unused docids off the start of each source database's range of docids. * Positional information is now encoded using a highly optimised fls() implementation, which is much faster than the FP code 0.9.x used. Unfortunately the old encoding could occasionally add extra bits on some architectures, which was harmless except the databases wouldn't be portable. Because of this, the flint format has had to be changed incompatibly. * The lock file is now called "flintlock" rather than "flicklock" (which was a typo!) * Flint now releases its lock correctly if there's an error in WritableDatabase's constructor. Previously the lock would remain until the process exited. * Flint now throws new Xapian::Error subclass DatabaseVersionError instead of DatabaseOpeningError when it fails to open a database because it has an unsupported version. DatabaseVersionError is a subclass of DatabaseOpeningError so existing code should continue to work, but it's now much easier to determine if the problem is that a database needs rebuilding. * If you try to open a flint database with an older or newer version than flint understands, the exception message now gives the version understood, rather than "I only understand FLINT_VERSION" (literally). * If we fail to obtain the lock, report why in the exception message. * Flint now compresses tags in the record and termlist tables using zlib. * More robust code to handle the flint locking child process, in case of unexpected errors. * If a document was replaced more than once between flushes, the document length wouldn't be updated after the first change. quartz backend: * Quartz is still supported, but use in new projects is deprecated (use Flint instead). Quartz will be removed eventually. * quartzcheck: Test if this is a quartz database by looking at "meta" not "record_DB". If "record_DB" is >= 2GB and we don't have a LFS aware stat function then stat can fail even though the file is there. Also open the database explicitly as a Quartz database for extra robustness. * If a document was replaced more than once between flushes, the document length wouldn't be updated after the first change. remote backend: * The remote backend is now supported under Microsoft Windows. * Open a fresh copy of the database(s) on each connection to a xapian-tcpsrv rather than relying on being able to share a database across fork() or between threads (which we don't promise will work). * xapian-tcpsrv: New "--interface" option allows the hostname or address of the interface to listen on to be specified (the default is the previous behaviour of listening on all interfaces). * If name lookup fails, report the h_errno code from gethostbyname() rather than whatever value errno happens to currently have! * Fix bugs in query unserialisation. * The remote backend now supports all operations (get_lastdocid(), and postlist_begin() have now been implemented). * Currently a read-only server can be opened as a WritableDatabase (which is a minor bug we plan to fix). In this case, operations which write will fail and the exception is now InvalidOperationError not NetworkError. * If a remote server catches NetworkTimeoutError then it will now only propagate it if we can send it right away (since the connection is probably unhappy). After that (and for any other NetworkError) we now just rethrow it locally to close the connection and let it be logged if required. * The timeout parameter to RemoteDatabase wasn't being used, instead the client would wait indefinitely for the server to respond. * A timeout of zero to the remote backend now means "never timeout". This is now the default idle timeout for WritableDatabase (the connection timeout default is now 10 seconds, rather than defaulting to the idle timeout). * Fix handling of the document length in remote termlists. * The remote backend now checks when decoding serialised string that the length isn't more than the amount of data available (bug#117). * The remote backend now handles the unique term variants of delete_document and replace_document on the server side. * The RSet serialisation now encodes deltas between docids (rather than the docids themselves) which greatly reduces the size of the encoding of a sparse RSet for a large database. * We now encode deltas between term positions when sending data after calling positionlist_begin() on a remote database. * When using a MatchDecider with remote database(s), don't rerun the MatchDecider on documents which a remote server has already checked. * Apply the "decreasing weights with remote database" optimisation which we use in the sort_by_relevance case in the sort_by_relevance_then_value case too. * We now throw NetworkError rather than InternalError for invalid data received over the remote protocol. * We now close stderr of the spawned backend program when using the "prog" form of the remote backend. Previously stderr output would go to the client application's stderr. muscat36 backend: * Support for the old Muscat 3.6 backends has been completely removed. It's still possible to convert Muscat 3.6 databases to Xapian databases by building 0.9.10 and using copydatabase to create a quartz database, which can then be read by 1.0.0 (and converted to a flint database using copydatabase again). build system: * We've added GCC visibility annotations to the library, which when using GCC version 4.0 or later reduce the size and load time of the library and increase the runtime speed a little. Under x86_64, the stripped library is 6.4% smaller (1.5% smaller with debug information). * configure: If using GCC, use -Bsymbolic-functions if it is supported (it requires a very recent version of ld currently). This option reduces the size and load time of the shared library by resolving references within the library when it's created. * We automatically define _FORTIFY_SOURCE in config.h if GCC is in use and it's not already set (you can override this as documented in INSTALL). This adds some checking (mostly at compile time) that important return values aren't ignored and that array bounds aren't exceeded. * `./configure --enable-quiet' already allows you to specify at configure time to pass `--quiet' to libtool. Now you can override this at make-time by using `make QUIET=' (to turn off `--quiet') or `make QUIET=y' (to turn on `--quiet'). * In non-maintainer mode, we don't need the tools required to rebuild some of the documentation, so speed up configure by not even probing for them in this common case. * The makefiles now use non-recursive make in all directories except "docs" and "tests". For users, this means that the build is faster and requires less disk space (bug#97). * configure: Add proper detection for SGI's C++ (check stderr output of "CC -v") and automatically pass -ptused in CXXFLAGS for xapian-core and any applications using xapian-config --cxxflags since it seems to be required to avoid template linking errors. * XO_LIB_XAPIAN now checks for the case where XAPIAN_CONFIG wasn't specified and xapian-config wasn't found, but the library appears to be installed - this almost certainly means that the user has installed xapian-core from a package, but hasn't installed the -dev or -devel package, so include that advice in the error message. * `./configure --with-stlport-compiler' now requires a compiler name as an argument. * configure: Disable probes for f77, gcj, and rc completely by preventing the probe code from even appearing in configure - this reduces the size of configure by 209KB (~25%) and should speed it up significantly. * configure: Suppress more unhelpful warnings and "remarks" for HP's aCC, and turn on "+wlint", which seems useful. * A number of cases of unnecessary header inclusions have been addressed, which should speed up compilation (fewer headers to parse when compiling many source files). This also reduces dependencies within the source code, and thus the number of files which need to be rebuilt when a header is changed. * configure: Cache the results of some of our custom tests. documentation: * The documentation has all been updated for changes in Xapian 1.0.0. * Many of the documentation comments in the API headers (which are collated using doxygen to generated the API reference) have been improved, and some missing ones added. Also, internal classes, members, and methods are now all marked as such so that none should appear in the generated documentation. In particular, the class inheritance graphs should be a lot clearer. A few other problems have also been addressed. * docs/internals.html: New separate index page for the "internal" documentation. * docs/deprecated.html: New document describing deprecation policy. This includes lists of features which have been removed, or which are deprecated and scheduled for removal, along with suggested replacements. * docs/admin_notes.html: New document introducing Xapian for sysadmins. * docs/termgenerator.html: New document describing the new term generation strategy implemented by the Term::Generator class. * docs/bm25.html,docs/intro_ir.html: These have been overhauled to make them fit better with the rest of the documentation, and with Xapian itself. * docs/overview.html: Fixed links to error classes in generated API documentation. * HACKING,INSTALL: Many updates and improvements. * xapian-config: Improve --version output so that help2man produces a better man page. * PLATFORMS: Remove reports for 0.7.* and demote reports for 0.8.* to "older reports" status. All SF compilefarm machines are now "no longer available", so update the symbols and key to reflect this. Update with recent success reports from the tinderbox and other sources. * AUTHORS: Thanks several bug reporters I missed before, as well as recent contributors. * docs/code_structure.html now looks nicer and includes links to svn.xapian.org. * docs/remote_protocol.html: Fixed several typos and other errors, and document all the new messages. * We no longer include docs/apidoc/latex/* in the xapian-core tarballs since it's just useless bloat. examples: * delve: + Report the exception error string if open a database fails. + Rename "-k" to "-V" since "keys" were renamed to "values" long ago. Keep "-k" as an alias for now, but don't advertise it. Add handling so "-V3" shows value #3 for every document in the database. + No longer stems terms by default. Add "-s/--stemmer" option to allow a stemmer to be specified. * quest: Add "--stemmer" option to allow stemming language to be set, or stemming to be disabled. portability: * Fix compilation with GCC 4.3 snapshot. * Always use pid_t not int for holding a process id, and use AC_TYPE_PID_T to `#define pid_t int' if doesn't provide pid_t. * Pass the 4th parameter of setsockopt() as char* which works whether the function actually takes char* or void* (since C++ allows implicit conversion from char* to void*). * Most warnings in the MSVC build have been fixed. * Refactored most portability workarounds into safeXXXX.h headers. * Building for mingw in a cygwin environment should work better now. packaging: * RPM spec file: + Updated for the changes in this release. + ChangeLog.examples is now packaged. debug code: * Rename --enable-debug* configure options - conflating the options to "turn on assertions" and "turn on logging" is confusing. `--enable-debug[=partial]' becomes `--enable-assertions'; `--enable-debug-verbose' becomes `--enable-log' and `--enable-debug=full' becomes `--enable-assertions --enable-log'. For now the old options give an error telling you the new equivalent. * Debug logging from expand is now all of type EXPAND (some was of types MATCHER and WTCALC before). * Hook the debug tracing in the lemon generated parser into Xapian's debug logging framework. * New assertion types: AssertEqParanoid() and AssertNeParanoid(). * Retry write() if it fails when writing a debug log entry to ensure to avoid the risk of a partial write. Xapian-core 0.9.10 (2007-03-04): API: * Fix WritableDatabase::replace_document() not to lose positional information for a document if it is replaced with itself with unmodified postings. * QueryParser: Add entries to the "unstem" map for prefixed boolean filters (e.g. type:html). * Fix inconsistent ordering of documents between pages with Enquire::set_sort_by_value_then_relevance (fixes bug#110). testsuite: * Workaround apparent bug in MSVC's ifstream class. flint and quartz backends: * Fix possible double-free after a transaction fails. * Fix code for recovering from failing to open a table for reading mid-modification. If modifications are so frequent that opening for reading fails 100 times in a row, throw DatabaseModifiedError not DatabaseOpeningError. * Don't call std::string::append(ptr, 0) when ptr may be uninitialised or NULL (rather suspect, and reported to cause SEGV-like behaviour with MSVC). * Ensure both_bases is set to false if we don't have both bases when opening a table using an existing object. * Use MS Windows API calls to delete files and open files we might want to delete while they are still open (i.e. the flint and quartz btree base files). This fixes a problem when a writer can't discard an old revision at the exact moment a reader is opening it (bug #108). remote backend: * Fix WritableDatabase::has_positions() to refetch the cached value if it might be out of date. * Fix incorrect serialisation of a query with non-default termpositions. inmemory backend: * If replace_document is used to set the docid of a newly added document which has previously existed, ensure we mark that document as valid. documentation: * Assorted improvements to API documentation. * docs/Makefile.am: The larger pool_size we set in 0.9.9 for building sourcedoc.pdf was a bit marginal, so increase it further. * docs/stemming.html,docs/install.html: Correct 2 references to "CVS" to say "SVN" instead. * HACKING: Update the release checklist. portability: * Fix flint and quartz to allow 2GB+ B-tree tables when compiling with MSVC. packaging: * RPMs: Remove "." from end of "Summary:". Package the new man page for xapian-progsrv. Xapian-core 0.9.9 (2006-11-09): testsuite: * Use popen() to run xapian-tcpsrv and wait for "Listening..." before returning rather than just sleeping for 1 second and hoping that's enough. * If we can't start xapian-tcpsrv because the port is in use, try higher numbered ports. remote backend: * xapian-tcpsrv: If the port requested is in use, exit with code 69 (EX_UNAVAILABLE) which is useful if you're trying to automate launching of xapian-tcpsrv instances. * xapian-tcpsrv: Output "Listening..." once the socket is open and read for connections (this allows the testsuite to wait until xapian-tcpsrv is ready before connecting to it). * xapian-progsrv: Now supports --help, --version, and has a man page. Fixes Bug #98. * Turn on TCP_NODELAY for the TCP variant of the remote backend which dramatically improves the latency of operations on the database. build system: * internaltest: Disable serialiselength1 and serialisedoc1 when the remote backend is disabled to fix build error in this case. * Move libbtreecheck.la from testsuite/ to backends/quartz/. * Move the testsuite harness from testsuite/ to tests/harness/. documentation: * Ship our custom INSTALL file rather than the generic one from autoconf which we've accidentally been shipping instead since 0.9.5. * docs/Makefile.am: Building sourcedoc.pdf needs a larger pool_size now we're using pdflatex. * HACKING: Update debian packaging checklist. * PLATFORMS: Updated with results from tinderbox. portability: * Create "safefcntl.h" as a replacement for instead of using "utils.h" for this purpose, since "utils.h" pulls in many other things we often don't need. packaging: * RPMs: Prevent binaries getting an rpath for /usr/lib64 on FC6. Xapian-core 0.9.8 (2006-11-02): API: * QueryParser: Don't require a prefixed boolean term to start with an alphanumeric - allow the same set of characters as we do for the second and subsequent characters. flint backend: * Only force a flush on WritableDatabase::allterms_begin() if there are actually pending changes. quartz backend: * Only force a flush on WritableDatabase::allterms_begin() if there are actually pending changes. * quartzcheck: Avoid dying because of an unhandled exception if the Btree checking code finds an error in the low-level Btree structure. Add a catch for any other unknown exceptions. build system: * When building with GCC, turn on warning flag -Wshadow even when not in maintainer mode (provided it is supported by the GCC version being used). * testsuite/backendmanager.cc: Fix compilation when valgrind is detected by configure. * If generating apidoc.pdf fails, display the logfile pdflatex generates since that is likely to show what failed. documentation: * Produce a PDF for apidoc rather than PostScript, since the PDF is smaller, plus at least as easy to print and easier to view for most users. Use pdflatex to generate the PDF directly rather than going via a DVI file which apparently produces a better result and also avoids problems on some Linux distros where latex is a symlink to pdfelatex (bug#81, bug#95). * HACKING: Mention automake 1.10 is out but we've not tested it yet. * HACKING: Add entries to release checklist: make sure new API methods are wrapped by the bindings, and that bug submitters are thanked. * HACKING: Note that on Debian, tetex-extra is needed for fancyhdr.sty. * HACKING: Note that dch can be used to update debian/changelog. * docs/code_structure.html: Document backends/remote. * PLATFORMS: Update from tinderbox. portability: * configure: When checking if we need -lm, don't use a constant argument to log() as the compiler might simply evaluate the whole expression at compile time. * configure: Redhat's GCC 2.96 doesn't support -Wundef even though real GCC version before and after it do! * configure: Avoid use of double quotes in double-quoted backticks since it causes problems on some platforms. * backends/flint/flint_io.cc: Fix compilation on windows (needs to #include "safewindows.h" to get definition of SSIZE_T). * Fix our implementation of om_ostringstream to compile so that the build works once more on older compilers without (regression probably introduced in 0.9.7). packaging: * xapian.spec: Package xapian-progsrv. Xapian-core 0.9.7 (2006-10-10): API: * QueryParser: + Allow a distance to be optionally specified for NEAR - e.g. "cats NEAR/3 dogs" (bug#92). + Implement "ADJ" operator - like "NEAR" except the terms must appear in matching documents in the same order as in the query. + Fix bug in how we handle prefixed quoted phrases and prefixed brackets. + Fix parsing of loved and hated prefixed phrases and bracketted expressions. + Fix handling of stopwords in boolean expressions. + Don't ignore a stopword if it's the only query term. * Document::add_value() failed to replace an existing value with the same number, contrary to what the documentation says (bug #82). * Enquire::set_sort_by_value(): Don't fetch the document data when fetching the value to sort on. Simple benchmarking showed this to speed up sort by value by a factor of between 3 and 9! * Implement transactions for flint and quartz. Also supported are "unflushed" transactions, which provided an efficient way to atomically group a number of database modifications. * The Xapian::Error and Xapian::ErrorHandler classes have been reimplemented. The new versions have better, clearer documentation comments and are cleaner internally. * Change how doubles are serialised by TradWeight, BM25Weight, and in the remote backend protocol. The new encoding allows us to transfer any double value which can be represented by both machines precisely and compactly. testsuite: * Add targets "check-flint", "check-quartz", and "check-remote" in tests and at the top level which run the subset of tests which test the respective backend. * apitest: Run tests on flint if flint is enabled, rather than if quartz is enabled! * apitest: Speed up deldoc4 when run in verbose mode - some stringstream implementations are very inefficient when the string grows long. * Turn on GLIBCXX_FORCE_NEW when running tests under valgrind to stop the GNU C++ STL from using a pooling allocator. This helps make velgrind's leak tracking more reliable. * Probe for required valgrind logging options at configure time rather than when running the test program. This saves about 2 seconds per test program invocation. * Fix testsuite harness to show valgrind output when a test fails (when running under valgrind in verbose mode). This had stopped working, probably due to changes in valgrind 3. * internaltest: Check that the destructor on a temporary object gets called at the correct time (Sun C++ deliberately gets this wrong by default, and it would be good to catch any other compilers which do the same). * apitest: When running tests on the remote backend and running under valgrind, run xapian-tcpsrv and xapian-progsrv under valgrind too to avoid issues with the precision of doubles (bug#94). flint backend: * Retry on EINTR from fcntl or waitpid when creating or releasing the flint lock file. * xapian-compact: Add --blocksize option to allow the blocksize to be set (default is 8K as before.) * WritableDatabase::replace_document(did, doc) was double-incrementing the "changes" counter when document did didn't exist so it would flush twice as often - fixed. * WritableDatabase::postlist_begin(): Remove forced flush when iterating the posting list of a term which has modified postings pending. quartz backend: * quartzcompact: Add --blocksize option to allow the blocksize to be set (default is 8K as before.) * WritableDatabase::replace_document(did, doc) was double-incrementing the "changes" counter when document did didn't exist so it would flush twice as often - fixed. remote backend: * Most of the remote backend has been rewritten. It now supports most operations which a local database does (including writing!), the protocol used is more compact, and a number of layers of classes have been eliminated and the sequences of method calls simplified, so the code should be easier to understand and maintain despite doing more. A number of bugs have been fixed in the process. * xapian-tcpsrv: Report errno if we catch a Xapian::Error which has it set. * xapian-tcpsrv: Fix memory leak in query unserialisation. build system: * Now using autoconf 2.60 for snapshots and releases. Also now using a libtool patch which improves support for Sun C++'s -library=stlport4 option. * configure: Fix generation of version.h to work with Solaris sed. * automake adds suitable rules for rebuilding doxygen_api_conf and doxygen_source_conf, so remove our less accurate versions. Also fix dependencies for regenerating the doxygen documentation, and make the documentation build work with parallel make. * Make use of the dist_ prefix to avoid having to list files in EXTRA_DIST as well as in *_DATA and man_MANS. * Removed a few unused #include-s. * include/xapian/error.h: Add hook to allow SWIG bindings to be built using GCC's visibility support. * configure: Turn on automake's -Wportability to help ensure our Makefile.am's are written in a portable way. * configure: Disable probing and short-cut tests for a FORTRAN compiler. We don't use one, but current libtool versions always check for it regardless. * xapian-config: Prune -L/usr/lib from output of `xapian-config --libs'. documentation: * docs/scalability.html: quartzcompact and xapian-compact now allow you to set the blocksize, so there's no need to use copydatabase if you want to migrate a database to a larger blocksize. Mention gmane. Other minor tweaks. * Eliminate "XAPIAN_DEPRECATED" from generated documentation. * PLATFORMS: Added success report for Nexenta (alpha 5), MSVC, and sparc linux. Updated other results from tinderbox. * Add links to the wiki from README and the documentation index. * docs/overview.html: Add discussion of uses of terms vs values. * docs/overview.html: Rewrite the section on Xapian::Document to remove some very out-of-date information and make it clearer. * include/xapian/database.h: Note that automatically allocated document IDs don't reuse IDs from deleted documents. * include/xapian/enquire.h: Note that "set_sort_by_relevance" is the default setting. * docs/queryparser.html,include/xapian/queryparser.h: Add note that FLAG_WILDCARD requires you to call set_database. * HACKING: Add some advice regarding debugging using -D_GLIBCXX_DEBUG, valgrind, and gdb. * HACKING: Give URL to Alexandre Duret-Lutz's autotools tutorial, which is much more up-to-date than the "goat book". * HACKING: Update and expand the information about the debian packaging. * Add missing dir_contents files. portability: * xapian/version.h: Add a check that _GLIBCXX_DEBUG is set compatibly if we're compiling with GNU C++ 3.4 or newer. * Add configure check to see if "-lm" is needed to get maths functions since newer versions of Sun's C++ compiler seem to require this. * Automatically put Sun's C++ compiler into "ANSI C++ compliant library" mode (using -library=stlport4). This allows us to remove most of the special case bits of code we've accumulated for just this compiler, which improves maintainability. * Sun's C++ compiler implements non-standards-conforming lifetimes for temporary objects by default. This means database locks don't get released when they should, so we now always pass "-features=tmplife" for Sun C++ which selects the behaviour specified by the C++ standard. Xapian-core 0.9.6 (2006-05-15): API: * Rename Xapian::xapian_version_string() and companions to Xapian::version_string(), etc. Keep the old functions as aliases which are marked as deprecated. * QueryParser: Add rules to handle a boolean filter with a "+" in front (such as +site:xapian.org). testsuite: * queryparsertest: Add another prefix testcase to improve coverage. build system: * configure: Simpler check for VALGRIND being set to empty value. * include/Makefile.am: Add xapian/version.h.timestamp as a dependency on all-local so that xapian/version.h actually gets regenerated when required. * Eliminate XAPIAN_BUILD_BACKEND_* from config.h and just use XAPIAN_HAS_*_BACKEND from xapian/version.h instead. documentation: * remote_protocol.html: Document keep-alive messages. * xapian/enquire.h: Remove bogus documentation for a parameter which doesn't exist. * PLATFORMS: Added a summary. Updated and pruned old entries for which we have a newer close match. * HACKING: Expand on details of what's required when changing Xapian (discuss documentation requirements, and more on why feature tests are vital). * HACKING: Update section on building debian packages. portability: * The tarball is generated with a patched version of libtool 1.5.22 which fixes libtool bugs on HP-UX and some BSD platforms. * configure: Fix problems with test for snprintf which affected cygwin, and possibly some other platforms. * configure: Tweak version.h generation to cope with CXXCPP putting carriage returns into its output as can happen on cygwin. * Fix renaming of "iamflint.tmp" for MS Windows where you can't rename an open file. * Fixed MSVC7 warnings. * Added workaround for newlib header bug. Xapian-core 0.9.5 (2006-04-08): API: * QueryParser: + Fix FLAG_BOOLEAN_ANY_CASE to really allow any case combination - previously it only allowed all uppercase or all lowercase. + Fix QueryParser's handling of terms with trailing "#", "+", or "-" when set_database has been called and the term doesn't exist in the database with the suffix. * Add mechanism to allow xapian-bindings to override deprecation warnings so we can continue to wrap deprecated methods without lots of warnings. * Move Enquire::get_matching_terms_end() and Document::termlist_end() inline in header. * Database::termlist_begin(): Eliminate the MultiTermList wrapper in the common case where we're only dealing with a single database. * Fix TermIterator::positionlist_begin() to work on TermIterator from Database::termlist_begin(). Make TermList::positionlist_begin() pure virtual and put dummy implementations in BranchTermList and other subclasses which can't (or don't) implement it. This makes it hard to accidentally fail to implement it in a backend's TermList subclass. * TermIterator::positionlist_begin() with the remote backend now throws UnimplementedError instead of InvalidOperationError. * Implement Enquire::set_sort_by_relevance_then_value(). testsuite: * Added missing feature test for QueryParser::FLAG_BOOLEAN_ANY_CASE. * remotetest: Check mset size in tcpmatch1. flint backend: * xapian-compact: Fixed segfault from passing an unknown option (e.g. "xapian-compact --foo"). quartz backend: * quartzdump,quartzcompact: Fixed segfault from passing an unknown option (e.g. "quartzdump --foo"). remote backend: * xapian-tcpsrv: Don't perform a name lookup on the IP address which an incoming connection is from as that could easily slow down the search response - instead just print the IP address itself if output is verbose. * xapian-tcpsrv: Allow up to 5 connections in the listen queue instead of just one. build system: * Removed unused code from the matcher and the remote, quartz, and flint backends. documentation: * All installed binaries now support --help and --version and have a man page (which is generated using help2man). * docs/overview.html: Bring up to date. * docs/remote_protocol.html: Document messages for requesting and sending a termlist and a document. * PLATFORMS, AUTHORS: Updated. * INSTALL: Improve wording. * HACKING: Note that we now use a lightly patched version of libtool 1.5.22. * HACKING: aclocal is part of automake, not autoconf. portability: * Added some tweaks to help support compilation with MSVC. packaging: * RPMs: package the new man pages. debug code: * Add missing spaces in some debug output. Xapian-core 0.9.4 (2006-02-21): API: * Flag deprecated methods such that the compiler gives a warning, for compilers which support such a feature (most notably GCC >= 3.1). * Correct typo in name of definition of function xapian_revision(). testsuite: * Updated uses of deprecated methods in the testsuite. build system: * xapian-config: Set exec_prefix and prefix at top of script so that xapian-config works after xapian-core is installed. documentation: * Add documentation comment for Enquire::set_sort_by_value_then_relevance(). * README: Add pointer to HACKING. Change "CVS access" to "SVN access". * PLATFORMS: Updated from tinderbox. * COPYING: Update second occurrence of old FSF address. Xapian-core 0.9.3 (2006-02-16): API: * Added 4 functions to report version information for the library version being used (which may not be the same as that compiled against if shared libraries are in use): xapian_version_string(), xapian_major_version(), xapian_minor_version(), xapian_revision(). * Xapian::QueryParser: + Fix handling of "+" terms in a query when the default query operator is AND. Added regression test for this. + Added "AND NOT" as a synonym for "NOT". Added feature tests for this. * Fix prototype for ESet::operator[] to take parameter of type termcount instead of doccount (doccount and termcount are both typedefs to the same type so this really just makes the prototype more consistent). * Xapian::Stem: Check for malloc and calloc failing to allocate memory and throw an exception. Richard has fixed this upstream in snowball, so this is a temporary fix until we import a new version of snowball. * Xapian::Database: Trying to open a database for reading which doesn't exist now fails with DatabaseOpeningError instead of FeatureUnavailableError. Added regression test for this. * Add Stopper::get_description() and SimpleStopper::get_description(). testsuite: * Fixed testsuite harness to work with valgrind on 64 bit platforms. * Merged the "running tests" section of docs/tests.html into the similar section in HACKING, and make docs/tests.html refer the reader to HACKING for more information. * Tidied and enhanced environmental variables which the test suite harness recongnises: + OM_TEST_BACKEND: Removed support since the "-b" switch to apitest allows you control which backend is used, making OM_TEST_BACKEND pretty much redundant. + XAPIAN_SIG_DFL: Renamed to XAPIAN_TESTSUITE_SIG_DFL. + XAPIAN_TESTSUITE_OUTPUT: New environmental variable to control use of ANSI colour escape sequences in test output (set to "plain" to disable them, unset, empty, or "auto" to check if stdout is a tty, or anything else to force colour). flint backend: * xapian-compact: Added "--multipass" option to merge postlists in pairs or triples until all are merged. Generally this is faster than an N-way merge, but it does require more disk space for temporary files so it's not the default. quartz backend: * quartzcheck: If the database is too broken to open, emit a warning message and bump the error count. build system: * Now generate snapshots and releases with automake 1.9.6 (was 1.9.5) and libtool 1.5.22 (was 1.5.18). * configure: If not cross-compiling, try to actually run a test program built with the C++ compiler, not just link one. * configure: Fix to actually skip the check for valgrind if VALGRIND is set to an empty value. * configure: Add sanity check for MS Windows that "find" is Unix-like find, not MSDOS-like. * Fix conditional compilation of flint backend - it was being disabled when quartz was, not when flint was supposed to be. documentation: * INSTALL,README: Updated. * Give pointer to replacements for the deprecated Enquire sorting methods in the doxygen collated documentation. * PLATFORMS: Added success reports for ppc64 linux and Fedora Core 4. Updated from the tinderbox. * HACKING: Note platforms valgrind now has solid support for; Improve phrasing in a few places. * Upgrade to using doxygen 1.4.6 for generating API documentation. * Change title of the "full source" documentation to "Internal Source Documentation" rather than "Full source documentation" to make it clearer it's only useful if you want to modify Xapian itself. * Fix documentation comments for the values of QueryParser::feature_flag so doxygen actually pulls out the documentation for them. Add documentation for the parameters of QueryParser::parse_query(). * queryparser.html: Document wildcards. portability: * Fix compilation with GCC 4.0.1 and later (need to forward declare class InMemoryDatabase) (bug #69). * Fix compilation under cygwin (broken in 0.9.2). * Don't pass NULL for the second parameter of execl() - the Linux man page says execl takes "one or more pointers to null-terminated strings". Also cast the NULL to (void*) to avoid "missing sentinel" warning from GCC4. * Use snprintf instead of sprintf where available (we were attempting to do this in some places before, but the configure test was broken so sprintf was always being used). * Enable more warnings under aCC and fix minor issues highlighted. Suppress "Entire translation unit was empty" warning which isn't useful to us. * Write top-bit set characters in the source using \xXX notation to avoid warnings from Intel's C++ compiler. * configure: TYPE_SOCKLEN_T fails hard, so only run it if we've successfully run other socket tests. * queryparser/accentnormalisingitor.h: #include for CHAR_BIT. * bin/xapian-compact.cc: Fix printf type mismatch on 64 bit platforms. * Replace pair with a simple class BoolAndString - the pair results in a 4328 byte symbol on HP-UX which gets truncated (to 4000 bytes). Most likely this is harmless, but it causes a warning. * configure: Disable flint backend by default if building for djgpp or msdos. * xapian-config: Previously when linking without libtool we've always thrown in dependency_libs, even though only some platforms need it (because it's generally pretty harmless). However some Linux distros have an unhelpful policy of not packaging .la files, so libxapian.la isn't available to extract dependency_libs from. Linux is a platform which doesn't require dependency_libs to be explicitly linked, so extend xapian-config to not pull in dependency_libs if libtool's link_all_deplibs_CXX=no. * xapian-config: If the current platform needs dependency_libs and libxapian.la's dependency_libs contains another .la file, transform it into a pair of -L and -l options, and recursively expand its dependency_libs (if any). * Don't pass functions with C++ linkage to places wanting pointers to functions with C linkage. So far this has worked for us, but it causes warnings with some compilers, and may not be portable. * Compaq C++ 7.1 doesn't suffer from the problem which previously prevented it from building Xapian. This release includes workarounds for some oddities with errno.h support in this compiler, but currently the build fails when trying to link a binary with the library. packaging: * RPM: Invoke %setup correctly in xapian.spec. debug code: * Add missing '#include ' when TIMING_PATCH is defined. Xapian-core 0.9.2 (2005-07-15): API: * QueryParser: + Added optional "flags" argument to parse_query method. + Add flag FLAG_BOOLEAN_ANY_CASE which tells the QueryParser that boolean operators such as "AND", "OR", and "NEAR" should be recognised even if they aren't fully capitalised (so "and", "And", "aNd", etc will work too). + Add flag FLAG_WILDCARD which tells the QueryParser to allow right truncation e.g. "xap*". + Fixed to handle "-site:microsoft.com" where site is a boolean prefix. Added testcases for this. testsuite: * The test harness was incorrectly creating a quartz database when a flint one was requested, which meant tests weren't being run against flint and so it had bugs rendering it pretty much unusable. * Added regression test longpositionlist1 (to check encoding/decoding a long position list, which flint had problems with). flint backend: * Bumped format version number. * Added new "xapian-compact" program which can compact and merge flint databases in a similar way to how quartzcompact does for quartz databases. * Fixed to auto-detect database type when opening an existing Flint database as a WritableDatabase. * The code to encode the position list size, first entry, and last entry didn't match the code to decode them! Reworked both to match, using a slightly more compact encoding. * We were failing to append "DB" to the path when opening a table for reading. * Rewrite of FlintAllTermsList with several fewer member variables. The rewrite fixes a bug too - the old version wasn't ignoring the metainfo entry which is now in the postlist table. * It seems we need to explicitly kill the child process used for locking. Otherwise when we have two databases locked just closing the connection doesn't cause the child to die. I don't understand why it's needed, but this fix is at least clean. quartz backend: * quartzcompact: Fix mis-repacking of keys in positionlist table when merging several databases. * Disable assertion in allterms iteration which is incorrect in a corner case. This is only a problem if a termname contains zero bytes and you're using a debug build. Add regression test test_specialterms2. remote backend: * Implement sorting on a value with the remote backend. build system: * Pass automake options to AM_INIT_AUTOMAKE rather than specifying them in Makefile.am. This way, the version requirements for autoconf and automake are stated close together. * configure: -Wshadow causes false positives with GCC 3.0.4, so only enable it for 3.1 and up. * configure: Eliminate use of "ln -s" when generating include/xapian/version.h since it seems to cause problems on Solaris in some setups and isn't really necessary. * Add dependency mechanism so version.h gets regenerated when the template is changed. * configure: Check for spaces in build directory, source directory, or install prefix and die with a helpful message. * Add dependency to generate queryparser_token.h. * Eliminated TOP_SRCDIR and TOP_BUILDDIR - it's better to just use top_srcdir and top_builddir directly. * configure: Generate the list of source files to feed to doxygen by inspecting all the Makefile.am files prior to running autoreconf rather than by using "find" when the user runs ./configure. This speeds up configure, avoids generating docs for random .cc and .h files which aren't part of xapian-core, and avoids problems with picking up FIND.EXE on MS Windows. documentation: * Expanded explanation of the "descending docid with boolean weighting" trick for fast date ordered searching in Enquire::set_docid_order() API docs. * docs/intro_ir.html: Citeseer has moved, so update link. * testsuite/testsuite.cc: Update URL for valgrind FAQ in comment. * COPYING: Update FSF address. * HACKING: Minor updates to release checklist. portability: * Assorted tweaks towards allowing compilation with MSVC. packaging: * xapian.spec.in: Package xapian-compact. Xapian-core 0.9.1 (2005-06-06): API: * Fix SEGV on get_terms_begin() on an empty Query object. This was causing a SEGV in Omega with an empty query. * Put Query::get_terms_end() inline in header. flint backend: * Added the new "flint" backend, which starts out as a copy of the quartz backend plus some modifications and replacements. When creating a database without a specified backend, quartz is still used unless the environmental variable XAPIAN_PREFER_FLINT is set to a non-empty value. * apitest now runs tests on flint as well as the other backends. * Removed undocumented (and hence the little used) quartz "log" feature. * Implement new fork+fcntl+exec based locking (for Unix) and CreateFile based locking (for Windows - currently untested). * Move the special key/tag pair holding the total document length and doc id high water mark from the record table to the postlist table. This means that when appending documents, the insertion point will now always be at the end of the record table which is more efficient. We need to jump around the postlist table to merge postings in anyway. * Changed metafile magic to be different from quartz, and make the metafile version a datestamp which we'll change each time the format changes. * Check the return value of close() when writing the metafile. * Flint position list table now stores entries using interpolative coding (which is significantly more compact). quartz backend: * quartzcheck: Fixed corner case where you couldn't check a single Btree table which was just the DB and baseA/baseB files in a directory (Xapian doesn't produce anything like this, but btreetest does while unit testing the Btree code). build system: * Releases are now created using libtool 1.5.18 and automake 1.9.5. * configure: Pass more -W flags to g++ (including -Wundef which caught the getopt problem fixed in this release). Fixed new GCC warnings from these new flags. * Fixed a lingering DOXYGEN_HAVE_DOT reference. * Fixed accidentally pruned #define which meant that getopt code was being included even on systems which use glibc (on such systems, we should use the glibc copy of the code instead). * queryparser/queryparser.lemony: Add missing '#include '. documentation: * Added missing documentation comments for a QueryParser methods added in 0.9.0. * docs/quartzdesign.html: Removed warning that quartz is still in development. * PLATFORMS: Updated from tinderbox. * configure: Describe CC_FOR_BUILD in configure --help output. * HACKING: Updated release instructions to refer to SVN, and note that release tarballs are now built specially rather than being copies of snapshots. Update information about the SVN tag name to use for debian files. * HACKING: Add "email Fabrice" to the release checklist so that RPM spec files don't lag behind. * Fixed a few spelling mistakes. packaging: * xapian.spec: Remove bogus %setup line left over from when we packaged xapian-core and xapian-examples together from separate tarballs. debug code: * api/omqueryinternal.cc: Fixed compilation with --enable-debug. * common/omdebug.h: Replace C style cast with static_cast<> which reveals that we were discarding const (harmlessly though). Xapian-core 0.9.0 (2005-05-13): API: * Query objects really need to be immutable after construction (otherwise we need a copy-on-write mechanism). To achieve this the following API changes were required: + Remove Query::set_length() in favour of an optional length parameter to Enquire::set_query(). + Eliminated Query::set_elite_set_size() in favour of optional parameter to constructor. + Eliminated Query::set_window() in favour of an optional parameter to the constructor. * Removed OP_WEIGHT_CUTOFF, since it doesn't actually seem to add useful functionality over using Enquire::set_cutoff(). * MSet::max_size() (which only exists so that MSet is an STL container) now returns MSet::size() and is inlined from the header. * Added ESet::max_size() (for STL compatibility). * Fixed Xapian::RSet to have the same "it's a handle" copy semantics as most of the other classes. * Rewritten QueryParser class: + Uses Lemon instead of Bison to generate the parser, which enables us to stop using static data, so this class is at last reentrant. + QueryParser now uses a PIMPL style with reference counted internals like most of the other Xapian classes. + Direct access to member variables has gone, which unfortunately forces an API change (but this fixes bug #39). Instead of accessing QueryParser::termlist member variable, iterate over terms using Query::get_terms_begin() and get_terms_end() on the returned Query object. Direct access to stoplist is replaced by QueryParser::get_stoplist_begin() and get_stoplist_end(); and to unstem by get_unstem_begin() and get_unstem_end(). + The rewrite parses many real world examples better than the old version. + Now allow searches for C#, etc. If a database has been set, for this and + and - suffixes, check if the term actually exists, and if not, ignore the suffix if the unsuffixed term exists. + Added QueryParser::get_description() method (not very descriptive yet!) + Added backward compatibility wrapper for old version of QueryParser::set_stemming_options(). + xapian.h now automatically includes xapian/queryparser.h. Directly including xapian/queryparser.h will continue to work for now, but is deprecated. + QueryParser::parse_query() was failing to clear termlist and unstem - the rewrite fixes this. + New QueryParser parses "term prefix:(term2 term3)" correctly. * Added Xapian::SimpleStopper which just stops terms specified by a pair of iterators. This should be sufficient for the majority of uses. * Tidied up the Enquire sorting API and added ability to reverse sort on a value. Removed sort_bands support. * Enquire::get_description() improved. * Methods which return an end iterator where the internals are just NULL are now inline in the header for efficiency. Should we ever need to change an implementation, we can easily move methods back into the library and bump the library version suitably. * Added Stem::operator() as preferred alternative to Stem::stem_word(). * Simplified Stem internal design by restructuring to eliminate a few internal methods. * BM25Weight: Avoid fetching document length if we're simply going to multiply it by zero! testsuite: * Fixed TEST_EQUAL_DOUBLE to use DBL_EPSILON correctly. * Rewrite of index_utils test harness code, removing unused and unusual features. Data files for tests are now easier to write. These changes also fix the bug that ^x didn't actually decode hex values correctly. * tests/testdata/etext.txt: Stripped carriage returns. * apitest: Extended stemlang1 to check that trying to create a stemmer for a non-existent language throws InvalidArgumentError. * queryparsertest: + Moved into tests/ subdirectory. + Reworked to use the standard testsuite harness. + Added tests for new features in the rewritten QueryParser. quartz backend: * quartzcheck: Now checks the structure of all the tables, not just the postlist table, and cross-checks doclen values between termlist and postlist tables. Recognises "--help" option. Should now continue after an error (typically it would crash before), and counts the number of errors found. Now exits with non-zero status if any errors were found. More readable output. * quartzcompact: Extended to allow merging several quartz databases to produce a single compact quartz database. This allows for faster building - simple index in chunks, then merge the chunks. * quartzcompact: Made full compaction a tiny bit more compact. * quartzcompact: Added "fuller compaction" mode, which ignores the usual "at least 4 items per block" rule. This achieves slightly tighter compaction, though it's probably not advisable to use this option if you plan to update the compacted database. * Improved compaction by a few % in non-full case. Tighter bound on amount of memory to reserve to read the tag into. * Fix skip_to on an allterms TermIterator to set the current term when the skip_to-ed term is in the database. Add regression test for this (allterms5). * Values are stored in sorted order so we can stop unpacking the list once we get to one after the one we're looking for (in the case where the one we're looking for doesn't exist). build system: * configure: Check that the C++ compiler can actually link a program. AC_LANG_CXX doesn't, and if it can't find a C++ compiler it'll just return "g++" which just leads to a later configure test failing in a confusing way. * configure: corrected configure output of "none known for yes" or "none known for no" to "none known for g++-3.2" or similar. * include/xapian/version.h: Define XAPIAN_HAS_xxx_BACKEND for each backend which is enabled. The bindings need this, and user code might find it useful too. * include/xapian/database.h: Don't declare the backend factory functions if the corresponding backend has been disabled. This means that trying to use a disabled backend will be caught at compile time rather than link time. * configure: Enhanced valgrind test to (a) see if --tool=memcheck is needed and (b) see if valgrind actually works (we don't want to try to use an x86 valgrind on an x86_64 box). * configure: Suppress 2 Intel C++ warnings which we can't easily code around, and enable -Werror automatically with --enable-maintainer-mode. * Clearer make rules for building Postscript doxygen docs. * Removed some no longer used code. * Moved a number of method definitions out of headers because they are virtual, or too large to be sensible candidates for inlining. * Eliminated the extra library for the queryparser - it's tiny compared to the main library and having it around just complicates things. * configure: We no longer need Bison, but we do need CC_FOR_BUILD to compile Lemon with. * Snapshot generator now appends _svn6789 or similar to the version string. Adjusted configure and XO_LIB_XAPIAN macro to take this into account. * configure: If any tools needed for documentation are missing and we're in maintainer mode, die with a suitable error in configure rather than with strange errors when building the documentation. * docs/Makefile.am: Explicitly set the pool_size for latex, because we now seem to overflow the default setting on some systems. * docs/Makefile.am: Use $(MAKE) instead of make. documentation: * Numerous improvements to documentation comments. Added documentation comments for QueryParser class. * HACKING: Added better description of how reference-counted API classes are structured. * HACKING: Note that '#include ' isn't supported by GCC 2.95, and other assorted minor tweaks. * HACKING: Note how to disable use of VALGRIND on the make check command line, or when using runtest directly. * Updated all documentation mentions of CVS to talk about Subversion instead. * PLATFORMS: Updated from tinderbox and other sources. * PLATFORMS: Added minimal testcase which fails to compile with Compaq's C++ compiler (cxx). * INSTALL,README: Updated. * docs/queryparser.html: Note that + and - work on phrases and bracketed expressions. * docs/intro_ir.html: Corrected two errors. * docs/stemming.html: Stemming appears to be applicable to Japanese so don't say it isn't! examples: * Moved xapian-examples module to examples subdirectory of xapian-core. * quest: Added stopword handling. portability: * configure: autoconf identifies Intel's C++ compiler as GCC, so probe for which we actually have. * Xapian will now compile cleanly with Intel C++ 8.1 on ia64 Linux and on x86 Linux. * backends/quartz/btree.cc: Fixed GCC compilation warning. * tests/api_db.cc: Fixed warning from Sun's C++ compiler. * configure: Automatically enable ANSI C++ mode for SGI's compiler with '-LANG:std'; check that any automatically determined flags for ANSI C++ mode actually allow us to compile a trivial program - if they don't it probably means the compiler isn't the one we were expecting, but one installed with the same name, so we now drop the flags in this case. * The compile on IRIX with SGI compiler is now warning free, apart from two "unused variable" warnings in Snowball generated code. * On WIN32, don't define NOMINMAX if it is already defined. packaging: * xapian.spec: Don't say "%makeinstall" in a comment since rpm tries to expand it and explodes. * xapian.spec: '/usr/share' -> '%{_datadir}'. * xapian.spec: Put the .so in the -devel package (it's only useful for linking to - the .so.* files are all that's needed at runtime). debug code: * net/socketserver.cc: Fixed typo in debug code. Xapian-core 0.8.5 (2004-12-23): quartz backend: * quartzcompact: When full_compaction is enabled, don't fill the last few bytes of a block if that would mean we needed an extra item and the overhead for that item would use up more of the next block than we save. This reduces the table size after full compaction by up to 0.2% in my tests! * quartzcompact: Tables sizes will always be a whole number of Kbytes, since the blocksize is, so report the size in K. Also report the change in size as well as the before and after sizes. * quartzcompact: Added missing '#include ' so that largefile support is enabled when we call stat() and we report compression statistics for tables > 2G. * quartzcompact: Added --no-full / -n option to disable full compaction. This may be useful if you want to update the database after compacting it (need to test to see if this option is actually useful). * Renamed Btree::compress() to Btree::compact() for consistency with "full_compaction" and "quartzcompact". Also, "compress" is confusing since we use that term in the zlib patch. build system: * xapian-config: Fixed --libs output to not include libxapian.la. * Added missing '#include ' to various .cc files (the omissions were probably harmless, but config.h should be included as the first thing any source file does). documentation: * Minor updates. packaging: * RPM spec file: %makeinstall puts the wrong paths in the .la files so use "make DESTDIR=... install" instead. debug code: * Fixed to build with AssertParanoid enabled. Xapian-core 0.8.4 (2004-12-08): API: * Added constructors to Database and WritableDatabase which fulfil the role that the Auto::open() factory functions currently do. Auto::open() is now deprecated. * Removed the ability to write a Xapian object to an ostream directly, as it's little used and potentially dangerous ('cout << mset[i];' will compile, but you almost certainly meant 'cout << *mset[i];'). You can get the old effect by writing 'cout << obj->get_description();' instead of 'cout << obj;'. Note that including xapian.h no longer pulls in fstream, which code may have been implicitly relying on - if this is a problem add '#include ' after '#include '. * QueryParser: Be smarter about when to add a ':' when adding a term prefix. * BoolWeight::unserialise() now returns BoolWeight*, and similarly for TradWeight and BM25Weight. BoolWeight::clone() now returns BoolWeight *. * If a database contains no positional information, change NEAR and PHRASE queries into AND queries (as otherwise they'd return no matches at all) (bug #56). Added feature test phraseorneartoand1. * Renamed BM25 parameters to match standard naming in papers and elsewhere (A->k3, B->k1, C->k2, D->b), eliminated the extra factor of 2 which our C had, and reordered the parameters to k1, k2, k3. This is an incompatible API change for BM25Weight(), so if you are using custom parameters for BM25 you'll need to update your code. * During query expansion, if we estimate the term frequency, ensure it has a sane value (>= r and <= N - R + r) rather than bodging around the problem later on. * TradWeight, BM25Weight: termfreq is always exact for matching (we only approximate it for query expansion) so replace code to work around bad approximations with Assert() to make sure this never happens. testsuite: * runtest: Enhanced to allow it to run test programs under valgrind and other tools (gdb was already supported). * runtest: now works with valgrind 2.1.2 and later (valgrind's --logfile-fd option was renamed to --log-fd). * runtest: Allow VALGRIND environmental variable to override the value we got from configure. * Added a dependency so "make check" regenerates runtest if necessary. * The test programs now point the user to the runtest script if srcdir can't be guessed. And they no longer look for the test program in the tests subdirectory of the current directory. * btreetest: Fixed memory leaks in test_cursor1 (the testcase itself was causing the leak, not the library). * apitest: Fixed mset_range_is_same() and mset_range_is_same_weights() helper functions which were only comparing the first item in the range. Thankfully the tests still all pass so this wasn't hiding any bugs. * apitest: A modified version of changequery1 fails - the bug is obscure and subtle, and the fix is tricky so set the modified test to SKIP for now. * apitest: Added test_weight1 which tests the built-in Xapian::Weight subclasses and test_userweight1 which tests user defined weighting schemes (bug#8). * quartztest: Test with DB_CREATE_OR_OPEN in writelock1. quartz backend: * An interrupted update could cause any further updates to fail with "New revision too low" because the new revision was being calculated incorrectly - fixed (bug#55). * Fixed Bcursor::del() which didn't always leave the cursor on the next item like it should. This may have been causing problems when trying to remove the last references to a particular term. * Fixed ultra-obscure bug in the code which finds a key suitable to discriminating between two blocks in a B-tree branch (discovered by reading the code). Comparing the keys didn't consider the length of the second, so it is possible the code would miscompare. But in reality this is extremely unlikely to happen, and even then would probably just mean that the discriminating key wouldn't be as short as it could be (wasting a few bytes but otherwise harmless). * If we're removing a posting list entirely, often there will only be one chunk, so avoid creating a Bcursor in this case. * Simplified Btree::compare_keys() by removing the last case which was dead code as it was covered by an earlier case. * Check that any user specified block size is a power of 2. If the block size passed is invalid, use the default of 8192 rather than throwing an exception. * Started to refactor the Btree manager by introducing Item and Key classes which take care of handling the on-disk format, and eliminated duplicated tag reading code in Btree and Bcursor. These changes will pave the way for improvements to the on disk format. * Applied the Quartz "DANGEROUS" patch, but disabled for now. This way it won't keep being broken by changes to the code. * quartzcompact: Added --help and --version; Check that the source path and desitination path aren't the same; Report each table name when we start compacting it, and some simple stats on the compaction achieved when we finish. muscat36 backend: * Removed a default parameter value from one variant of Xapian::Muscat36::open_db() so that there's only one candidate for open_db(string). build system: * xapian-config: If flags are needed to select ANSI mode with the current compiler, then make xapian-config --cxxflags include them so that Xapian users don't have to jump through the same hoops we do. * xapian-config: Added --swigflags option for use with SWIG. * XO_LIB_XAPIAN now passes ac_top_srcdir to xapian-config which uses it (if provided) to say "configure.ac" or "configure.in" rather than "configure.in (or configure.ac)" in the "Add AC_PROG_LIBTOOL" error message. * Cleaned up the build system in a few places. * Removed a few totally unneeded header includes. * Moved a number of functions and methods out of headers because they're not good inlining candidates (too big or virtual methods). * Changed C style casts to C++ style. The syntax is ugly, but they do make the intent clearer which is a good thing. Note this as a coding style guideline in HACKING. * configure.ac: Automatically add -Werror to CFLAGS and CXXFLAGS if maintainer mode is enabled and we're using GCC3 or newer. Don't do this for older GCCs as GCC 2.95 issues spurious warnings. * Reworked how include/xapian/version.h is generated so that it works better with compilers other than GCC, and with HP-UX sed. * XAPIAN_VERSION is now a string (e.g. "0.8.4"). * Added new #define XAPIAN_REVISION (which is 4 for version 0.8.4). documentation: * docs/bm25.html,docs/intro_ir.html: Reworked to talk about Xapian rather than Muscat. Also improved the appearance of the formulae. * HACKING: Valgrind now supports x86 FreeBSD and PowerPC Linux. * Documented parameters of Enquire::register_match_decider(). * We now use doxygen 1.3.8 to build documentation for snapshots and releases. * PLATFORMS: Updated from the tinderbox (which now runs builds on machines available in HP's testdrive scheme) and other assorted reports. * PLATFORMS: Removed reports from versions prior to 0.7.0. So much has changed that these are of little value. * docs/scalability.html: Added note warning about benchmarking from cold. * Assorted other minor documentation improvements. portability: * configure.ac: Improved snprintf configure test to actually check that it works (older implementations may have different semantics for the return value, and at least one ignores the length restriction entirely!) * Reworked the GNU getopt source we use so that the header is clean and suitable for use from a reasonably ISO-conforming C++ compiler instead of being full of cruft for working around quirky C compilers which C++ compilers tend to stumble over. * Use SOCKLEN_T for the type we need to pass to various socket calls, since HPUX defines socklen_t yet wants int in those calls. Reworked the TYPE_SOCKLEN_T test we use. * On Windows, we want winsock2.h instead of sys/socket.h. Mingw doesn't seem to even have the latter, so I think previously we've been compiling by picking one up from somewhere random! * Change the small number of C sources we have to be C++ so we can compile everything with the C++ compiler. This way we don't need to worry about configure choosing a mismatching pair of compilers, or about whether configure tests with the C compiler don't apply to the C++ compiler, or vice versa. * Compiles and passes testsuite with HP's aCC (we have to compile in ANSI mode, so we automatically add -AA to CXXFLAGS). * If the link test detects pread and pwrite are present, get configure to try out prototypes for pread and pwrite. This is much cleaner than trying to find the right combination of preprocessor defines to get each platform's system headers to provide prototypes. * configure: Disable probing for pread/pwrite on HP-UX as they're present but don't work when LFS (Large File Support) is enabled, and we definitely want LFS. * Fixed some warnings from Sun's C++ compiler. * Provide our own C_isalpha(), etc replacements for isalpha(), etc which always work in the C locale and avoid signed char problems. * For mingw/cygwin, pass -no-undefined when linking libxapianqueryparser.la so libtool builds a shared library. Also pass the magic linker flag -Wl,--enable-runtime-pseudo-reloc if configure has determined it is needed. * For cygwin, use the underlying MoveFile API call for locking, as link() doesn't work on FAT partitions. And don't rely on HAVE_LINK to control whether we use link() otherwise - if the configure test somehow misfires, a compilation error is better than using rename() on Unix as that would cause a second writer to smash the lock of the first. * Closer to building with Compaq C++ - add "-std strict_ansi" to CXXFLAGS, and tweaked the code in several places. It currently dies trying to compile the PIMPL smart pointer template code which looks hard to fix. debug code: * HACKING: Document that %% in XAPIAN_DEBUG_LOG is substituted with the process-id, and that setting XAPIAN_DEBUG_FLAGS to -1 enables all debug messages. * Removed compatibility code for checking environment variables OM_DEBUG_FILE and OM_DEBUG_TYPES. Xapian-core 0.8.3 (2004-09-20): API: * 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). remote backend: * Renamed omtcpsrv to xapian-tcpsrv and omprogsrv to xapian-progsrv. packaging: * RPM packaging now has a separate package for the runtime libraries to allow 32 and 64 bit versions to be installed concurrently. * RPM for xapian-core now includes binaries from xapian-examples. debug code: * Fixed to compile with debug tracing enabled. Xapian-core 0.8.2 (2004-09-13): API: * Removed the compatibility layer which allowed programs written against the pre-0.7.0 API to be compiled. * Added new ESet methods swap(), back() and operator[]. * Xapian::WritableDatabase::replace_document can now be used to add a document with a specific docid (to allow keeping docids in sync with numeric UIDs from another system). * Added Xapian::WritableDatabase::replace_document and delete_document variants which take a unique id term name rather than a document id. * Enquire::get_mset(): If a matchdecider is specified and no matches are requested, the lower bound on the number of matches must be 0 (since the matchdecider could reject all the matches). * Renamed Query::is_empty() to Query::empty() for consistency. Keep Query::is_empty() for now as a deprecated alias. * Enquire::set_sorting() now takes an optional third parameter which allows you to specify a sort by value, then relevance, then docid instead of by value then docid. * Enquire::get_mset() now takes an optional "check_at_least" parameter which allows Omega's MIN_HITS functionality to be implemented in the matcher (where it can be done a bit more efficiently). testsuite: * Reworked quartztest's positionlist1 into a generic api test as apitest's poslist3. * apitest: Reenabled allterms2, but with the iterator copying parts removed - TermIterator is an input_iterator so that part was invalid. * Overhauled btreetest and quartztest - tests at the Btree level are now all in btreetest. Those at the QuartzDatabase level are in quartztest. * Split api_db.cc into 3 files as it has grown rather large. * tests/runtest: Added support for easily running gdb on a test program, automatically sorting out srcdir and libtool. quartz backend: * Refactored the quartz backend code to reduce the number of layered classes and eliminate unnecessary buffering, reducing memory usage so that more posting list changes can be batched together (see next change) and database building can be done several times faster. * Added tunable flush threshold - set XAPIAN_FLUSH_THRESHOLD=50000 to flush every 50000 documents. The default is now every 10000 documents (was every 1000 documents previously). The optimum value will most likely depend on your data and hardware. * WritableDatabase::get_document() no longer forces pending changes to be flushed. The document will read things lazily from the database, and that reading may trigger a forced flush). * WritableDatabase::get_avlength() no longer forces pending changes to be flushed. This means you can now search a modified WritableDatabase without causing a flush unless the search includes a term whose postlist has pending modifications. * Reduced quartz postlist chunk threshold from "2048 or a few bytes more" to "2000 or a few bytes more" so that full size chunks won't get split by the Btree. * Improved the "Db block overwritten" message. The DatabaseCorruptError version now suggests multiple writers may be the cause, while the DatabaseModifiedError version uses less alarming wording and says to call Database::reopen(). * QuartzWritableDatabase now stores the total document length and the last docid itself rather than tallying added and removed document length and writing the last docid back every time a document is added. This gives cleaner code and a small performance win. * Make the first key null for blocks more than 1 away from the leaves. It saves disk space for a tiny CPU and RAM cost so is bound to be a win overall. * matcher/localmatch.cc: Fixed problems handling termweights in queries with the same term repeated (bug #37) and added regression test (qterminfo2). * Sped up iteration over all the terms in a database (QuartzCursor now only reads the tag from the Btree if asked to). * Cancelling an operation is now implemented more efficiently. inmemory backend: * Fixed bugs with deleting a document while a PostingIterator over it is active. muscat36 backend: * Fixed to compile now that internal_end_session() has gone (broken in 0.8.1). build system: * Fixed to compile when configured with --disable-inmemory (bug #33). * XO_LIB_XAPIAN now AC_SUBSTs XAPIAN_VERSION so your application's build system can easily check for a particular version of Xapian. * When compiling with GCC, we check that the compiler used to compile the library and the compiler used to compile the application have compatible C++ ABI versions. Unfortunately GCC 3.1 incorrectly reports the same ABI version as GCC 3.0, so we now special case that test. * Bumped the versions of the autotools we require for bootstrapping, and updated the documentation of these in the HACKING document. * Quote macro names to fix warnings from newer aclocal. documentation: * Improved API documentation for Xapian::WritableDatabase::replace_document and delete_document. * Added documentation comments for MSet methods size(), empty(), swap(), begin(), end(), back(). * Removed bogus documentation comments saying that some Enquire methods can throw DatabaseOpeningError. * Updated quartz design docs to reflect recent changes. Also pulled out the Btree and Bcursor API docs and slotted them in as doxygen documentation comments - this way they're much more likely to be kept up-to-date. * Corrected multiple occurrences of "an Xapian::XXX" to "a Xapian::XXX" (presumably these all resulted from replacing "Om" with "Xapian::"). * Various minor updates and improvements. portability: * Reworked how we cope with fcntl.h #define-ing open on Solaris. This change finally allows Sun's C++ compiler to produce a working Xapian build on sparc Solaris! * configure.ac: Don't define DATADIR - we no longer use it and clashes with more recent mingw headers. * matcher/andpostlist.cc: Initialise lmax and rmax to 0. This cures the SIGFPE on apitest's qterminfo2 on alpha linux. Xapian-core 0.8.1 (2004-06-30): API: * New method Xapian::Database::get_lastdocid which returns the highest used document id for a database (useful for re-synchronizing an indexer which was interrupted). Implemented for quartz and inmemory. * Xapian::MSet::get_matches_*() methods now take collapsing into account, and the documentation has been clarified to state explicitly that collapsing and cutoffs are taken into account (bug#31). * Xapian::MSet: Need to adjust index by firstitem when indexing into items (bug#28). * MSetIterator and ESetIterator are now bidirectional iterators (rather than just input iterators) * Fixed post-increment forms of PostingIterator, TermIterator, PositionIterator, and ValueIterator so that *i++ works (as it must for them to be true input iterators). * Xapian::QueryParser: If we fail to parse a query, try stripping out non-alphanumerics (except '.') and reparsing. * Fixed memory leaked upon Xapian::QueryParser destruction. * Removed several unused Xapian::Error subclasses (these were used by the indexer framework which we decided was a failed experiment). testsuite: * queryparsertest: Pruned near-duplicate queryparsertest testcases. * queryparsertest: Added test case for `term NOT "a phrase'. * remotetest: Use 127.0.0.1 instead of localhost so that tcpmatch1 doesn't fail just because the network setup is broken. * apitest: Make emptyquery1 check that Query("") causes an InvalidArgumentError exception. quartz backend: * Fixed bug which meant we sometimes failed to remove a posting when deleting or replacing a document. * Fixed PostlistChunkReader to take a copy of the postlist data being read to avoid problems with reading data from a string that's been deleted. * Fixed bug in postlist merging which could occasionally extend a postlist chunk to overlap the docid range of the next chunk. * Eliminated the split cursor in each Btree object - we only actually need a single block buffer to handle splitting blocks. This reduces the memory overhead of each Bcursor (and hence each QuartzPostList). * Changed 2 calls to abort() to throw Xapian::DatabaseCorruptError instead, * If Btree is writable, throw DatabaseCorruptError if we detect overwritten. * Check the return value of fdatasync()/fsync()/_commit() and raise an error. If they fail, we really want to know as it could cause data corruption. * Assorted clean ups, improved comments, debug tracing, assertions. * When merging in postlist changes, removed an unneeded call to QuartzBufferedTable::get_or_make_tag() in a case when we're using a cursor which has already fetched the tag. * Added SON_OF_QUARTZ define to disable incompatible changes to database formats by default, and use it to control the docid encoding for keys such that we're always inserting at the end of the table when added new documents. * Reopening the readonly version of a writable Btree is now more efficient (we used to close and reopen all the files and destroy and recreate a lot of objects and buffers). * Share file descriptors between the read and write Btree objects so that a quartz WritableDatabase now uses 5 fds rather than 10. * Added configure test for glibc, because otherwise we need to include a header before we can check for glibc in order to define something we should be defining before we include any headers! Defining _XOPEN_SOURCE on OpenBSD seems to do the opposite to Linux and *disable* pread and pwrite! backends: * Stripped out the session machinery - all that is actually required is to ensure that any unflushed changes are flushed when the destructor runs. * A few other backend interface cleanups. build system: * Unified the shlib version numbers (the small benefit of tracking them individually makes it hard to justify the extra work required, and having one version simplifies debian packaging too). * configure.in: Fix typo (STLPORT_CXXLAGS -> STLPORT_CXXFLAGS) * Removed trivial m4/Makefile.am and autoconf/Makefile.am and do the work from the top level Makefile.am instead. It's easier to see the structure this way, and it also removes a couple of recursive make invocations which will speed up builds a little. documentation: * HACKING: Added a list of subtasks when doing a release. Currently it's always me that does this, but it may not always be and anyhow it'll help me to have a list to run through. * include/xapian/database.h: Remove references to sessions in doxygen comments. * docs/quickstart.html: Corrected lingering reference to "om.h" and note that we need . * docs/quickstartindex.cc.html,docs/quickstartexpand.cc.html, docs/quickstartsearch.cc.html: Add . * PLATFORMS,AUTHORS: Updated. * docs/quartzdesign.html: Corrected various pieces of out of date information, and improved wording in a couple of places. * docs/scalability.html: Removed the reference to the Quartz update bottleneck "currently being addressed for Xapian 0.8" as it's now been addressed! Also reworded to remove use of first person (it was originally a message sent to the mailing list). Xapian-core 0.8.0 (2004-04-19): * Omega, xapian-examples and xapian-bindings now have their own NEWS files. API: * Throw an exception when an empty query is used to build in the binary operator Query constructor (previously this caused a segfault. Added regression test. * Made the TradWeight constructor explicit. This is technically an API change as before you could pass a double where a Xapian::Weight was required - now you must pass Xapian::TradWeight(2.0) instead of 2.0. That seems desirable, and it's unlikely any existing code will be affected. * Added "explicit" qualifier to constructors for internal use which take a single parameter. * Renamed Xapian::Document::add_term_nopos to Xapian::Document::add_term (with forwarding wrapper method for compatibility with existing code). * The reference counting mechanism used by most API classes now handles creating a new object slightly more efficiently. * Xapian::QueryParser: Don't use a raw term for a term which starts with a digit. testsuite: * apitest, quartztest: Added a couple of tests, and commented out some test lines which fail in debug builds. * quartztest: cause a test to fail if there's still a directory after a call to rmdir(), or if there isn't a directory after calling mkdir(). * apitest: Check returned docids are the expected values in a couple more cases. Improved wording of a comment. quartz backend: * We now merge a batch of changes into a posting list in a single pass which relieves an update bottleneck in previous versions. * When storing the termlist, pack the wdf into the same byte as the reuse length when possible - doing so typically makes the termlist 14% smaller! This change is backward compatible (0.7 database will work with 0.8, but databases built or updated with 0.8 won't work with 0.7). * quartzcheck: Check the structure within the postlist Btree as well as the Btree structures themselves. * Reduced code duplication in the btree manager and btreechecking code. * quartzdump: Backslash escape space and backslash in output rather than hex encoding them; renamed start-term and end-term to start-key and end-key; removed rather pointless "Calling next" message; if there's an error, write it to stderr not stdout, and exit with return code 1. * Corrected a number of comments in the source. * Removed several needless inclusions of quartz_table_entries.h. * Removed OLD_TERMLIST_FORMAT code - it has been disabled for since 0.6.0. * Removed all the quartz lexicon code and docs. It's been disabled for ages, and we've not missed it. build system: * XO_LIB_XAPIAN autoconf macro can now be called without arguments in the common case where you want the test to fail if Xapian isn't found. * Fixed the configure test for valgrind - it wasn't working correctly when valgrind was installed but was too a version to support VALGRIND_COUNT_ERRORS and VALGRIND_COUNT_LEAKS. * GCC 2.95 supported -Wno-long-long and is our minimum recommended version, so unconditionally use -Wno-long-long with GCC, and don't test for it on other compilers (the old test incorrectly decided to use it with SGI's compiler resulting in a warning for every file compiled). documentation: * Updated the quickstart tutorial and removed the warning that "this document isn't up to date". * docs/intro_ir.html: Added a link to "Information Retrieval" by Keith van Rijsbergen which can be downloaded from his website! * docs/quartzdesign.html: Some minor improvements. * docs/matcherdesign.html: Merged in more details from a message sent to the mailing list. * docs/queryparser.html: Grammar fixes. * Doxygen wasn't picking up the documentation for PostingIterator and PositionListIterator - fixed. Added doxygen comments for Xapian::Stopper and Xapian::QueryParser. * PLATFORMS: Updated with many results from tinderbox and from users. * AUTHORS: Updated the list of contributors. * HACKING: XAPIAN_DEBUG_TYPES should be XAPIAN_DEBUG_FLAGS. * HACKING: Updated to mention that building from CVS requires `./configure --enable-maintainer-mode' (or use bootstrap). * HACKING: Added notes about using "using", and pointers to a couple of useful C++ web resources. portability: * Solaris: Code tweaks for compiling with Sun's C++ compiler. * IRIX: Code tweaks for compiling with SGI's C++ compiler. * NetBSD mkdir() doesn't cope with a trailing / on the path - fixed our code to cope with this. * mingw/cygwin: Only use O_SYNC (on the debug log) if the headers define it. * backends/quartz/quartz_table_manager.cc: Fix for building on mingw. * mingw: Added configure test for link() to avoid infinite loop in our C++ wrapper for link. * mingw and cygwin both need -Wl,--enable-runtime-pseudo-reloc passing when linking. Arrange for xapian-config to include this, and check that the ld installed is a new enough version (or at least that it was at configure time). Also pass to programs linked as part of the xapian-core build. * cygwin: Close a QuartzDatabase or QuartzWritableDatabase before trying to overwrite it - cygwin doesn't allow use to delete open/locked files... * backends/quartz/quartz_termlist.cc: Use Xapian::doccount instead of unsigned int in set_entries(). * Database::Internal::Internal::keep_alive() should be Database::Internal::keep_alive(). * Make Xapian::Weight::Weight() protected rather than private as we want to be able to call it from derived classes (GCC 3.4 flags this, other compilers seem to miss it). debug code: * Open debug log with flag O_WRONLY so that we can actually write to it! * backends/quartz/quartz_values.cc: Fixed problem with dereferencing a pointer to the end of a string in debug output. Xapian 0.7.5 (2003-11-26): API: * Xapian::QueryParser now supports prefixes on phrases and expressions (e.g. author:(twain OR poe) subject:"space flight"). * Added missing default constructors for TermIterator, PostingIterator, and PositionIterator classes. * Fixed PositionIterator assignment operator. testsuite: * queryparsertest: Added testcase for new phrase and expression prefix support. * apitest: Added regression tests for API fixes. backends: * quartzcompact: Fix the name that the meta file gets copied to (was /path/to/dbdirmeta rather than /path/to/dbdir/meta). build system: * Changed to using AM_MAINTAINER_MODE. If you're doing development work on Xapian itself, you should configure with "--enable-maintainer-mode" and ideally use GNU make. * Fixed configure test for fdatasync to work (I suspect a change in a recent autoconf broke it as it relied on autoconf internal naming). * Fully updated to reflect move of libbtreecheck.la from backends/quartz to testsuite. btreetest and quartzcheck should build correctly now. documentation: * Added first cut of documentation for Xapian::QueryParser query syntax. * Fixed incorrectly formatted doxygen documentation comments which resulted in some missing text in the collated API and internal classes documentation. * Documented --enable-maintainer-mode and problems with BSD make in HACKING. * Fixed typo in docs/scalability.html. * PLATFORMS: Updated from the tinderbox. omega: * omega: Parsing of the probabilistic query is now delayed until we need some information from it. This means that we can now use options set by the omegascript template to control the behaviour of the query parser. $set{stemmer,...} now controls the stemming language (e.g. $set{stemmer,fr}) and $setmap{prefix,...} now sets the QueryParser prefix map (e.g. $setmap{prefix,subject,XT,abstract,XA}). * omega: Fixed $setmap not to add bogus entries. * docs/omegascript.txt: Expanded documentation of $set and $setmap to list values which Omega itself makes use of. * omega: Cleaned up the start up code quite a bit. * omega: Removed the unfinished code for caching omegascript command expansions. Added code to cache $dbsize. The only other value correctly marked for caching is already being cached! Xapian 0.7.4 (2003-10-02): API: * Fixed small memory leak if Xapian::Enquire::set_query() is called more than once. * Xapian::ESet now has reference counted internals (library interface version bumped because of this). * Removed unused OmDocumentTerm::termfreq member variable. * OmDocumentTerm ctor now takes wdf, and replaced set_wdf() with inc_wdf() and dec_wdf(). * Removed unused open_document() method from SubMatch and derived classes. * Calls made by the matcher to Document::Internal::open_document() now use the lazy flag provided for precisely this purpose, but apparently never used - this should give quite a speed boost to any matcher options which use values (e.g. sort, collapse). testsuite: * Finished off support for running tests under valgrind to check for memory leaks and access to uninitialised variables. * apitest: Sped up deldoc4. * btreetest: Removed superfluous `/'s from constructed paths. * quartztest: adddoc2 now checks that there weren't any extra values created. backends: * quartz: don't start the document's TermIterator from scratch on every iteration in replace_document(). Should be a small performance win. * quartz: Pass 0 for the lexicon/postlist table when creating a termlist just to find the doc length. * quartz: quartz_table_entries.cc: Removed rather unnecessary use of const_cast. * quartz: quartz_table.cc: Removed unused variable. * quartz: Improved encapsulation of class Btree. build system: * libbtreecheck.la now has an explicit dependency on libxapian.la. * We now set the dependencies for libxapian correctly so that linking applications will pull in other required libraries. * matcher/Makefile.am: Ship networkmatch.cc even if "make dist" is run from a tree with the remote backend disabled. * configure.in: Sorted out tests for gethostbyname and gethostbyaddr using standard autoconf macros. * configure.in: If fork is found, but socketpair isn't, automatically disable the remote backend rather than configure dying with an error. * autoconf/: Removed various unused autoconf macros. portability: * xapian-config.in: Link with libxapianqueryparser before libxapian, since that's the dependency order. * Removed or replaced uses of and in the library sources - we don't need or want the library to pull in cin and friends. * extra/queryparser.yy: Fixed to build with Sun's C++ compiler. * Make the dummy source file C++ rather than C so that automake tells libtool that this is a C++ library - vital for correct linking on some platforms. * Makefile.am: Pass -no-undefined to libtool so that we can build build a DLL on MS Windows. * configure.in: Fixed check for socketpair - we were automatically disabling the remote backend on platforms where socketpair is in libsocket (such as Solaris). * Use O_BINARY for binary I/O if it exists. * common/utils.h: mkdir() only takes one argument on mingw. * common/utils.h,testsuite/backendmanager.cc: Touch file using open() rather than system(). * common/utils.cc: Fixed to compile if snprintf isn't available. documentation: * docs/scalability.html: Fixed slip (32GB should be 32TB); Added note about Linux 2.4 and ext2 filesize limits. * PLATFORMS: Updated. * NEWS: Fixed a few typos. bindings: * xapian.i: using namespace std in SWIG parsed segment to sort out typemaps. packaging: * Updated RPM packaging. omega: * omega: $topdoc now ensures the match has been run; $date no longer ensures the match has been run. * omega: Fixed to build with Sun's C++ compiler. Xapian 0.7.3 (2003-08-08): API: * MSetIterator: Fixed MSetIterator::get_document() to work when get_mset() was called with first != 0 (regression test msetiterator3). testsuite: * internaltest: Changed test exception1 to actually test something (hopefully what was originally intended!) * Added long option support to the testsuite programs (and quartzdump). * Testsuite now builds on platforms for which we use our own stringstream implementation. * Only use \r in test output if the output is a tty. * Increased default timeout used by tests running on the remote backend from 10 seconds to 5 minutes to avoid tests failing just because the machine running them is slow and/or busy. * Fixed check for broken exception handling - we were getting "Xapian::" prefixed to one version and not on the other. * tests/runtest: Set srcdir if it isn't already to make it easy to manually run test programs from a VPATH build. * apitest: Check termfreq in allterms4. backends: * quartz: Fixed allterms TermIterator to not give duplicate terms when a posting list is chunked; added regression test (allterms4). * quartz: Check for EINTR when reading or writing blocks and retry the operation. This should mean quartz won't fail falsely if a signal is received (e.g. if alarm() is used). build system: * Renamed libomqueryparser to libxapianqueryparser - for backward compatibility we still provide a library with the old name for now. * xapian.m4: Added XO_LIB_XAPIAN to replace OM_PATH_XAPIAN. XO_LIB_XAPIAN will automagically enable use of "xapian-config --ltlibs" if A[CM]_PROG_LIBTOOL is used in configure.in. * xapian-config: Now supports linking with libtool - using libtool means that the run-time library path is set and that you can now link with an uninstalled libxapian. Also xapian-config will now work once xapian-core's configure has been run, rather than only after "make all". * xapian-config: Now automatically tries to link libxapianqueryparser too. * bootstrap: Removed bootstrap scripts in favour of top-level bootstrap which creates a top-level configure you can optionally use to configure all checked out Xapian modules with one command, and which creates a top level Makefile to build all checked out Xapian modules with one command. * Added versioning information to libxapian and libxapianqueryparser. * xapian-example/omega: Use libtool and XO_LIB_XAPIAN so we can link with an uninstalled Xapian, and so the run time load path gets built into the binaries (no need to set LD_LIBRARY_PATH just because you install Xapian with a non-standard prefix). * configure: Stop the API documentation from being regenerated when include/xapian/version.h changes (since it's generated by configure). * Fixed "make dist" in VPATH builds. portability: * common/getopt.h: #include , , and before defining getopt as a macro - this avoids problems with clobbering prototypes of getopt() in system headers. * bin/quartzcompact.cc: Need stdio.h for rename(). * languages/Makefile.am: Fixed compilation for compilers other than GCC. * Moved rset serialisation into a method of RSet::Internal, so omrset_to_string() is now just glue code. This eliminates the need for it to be a friend of RSet::Internal which Sun's C++ compiler didn't seem to be able to cope with. documentation: * Fix incorrect documentation comment for Enquire::set_set_forward(). (Looked like a cut&paste error) * COPYING: Updated FSF address, and reinstated missing section: "How to Apply These Terms to Your New Programs" * PLATFORMS: Updated some linux results: RH7.3 on x86, and Debian on alpha and arm; Updated FreeBSD success report; Updated with results from the tinderbox. * docs/mkdoc.pl: Don't choke on a comment at the end of the DIST_SUBDIRS line in a Makefile.am. * HACKING: Improved note about why libtool 1.5 is needed. * HACKING: Added note about additional tools needed for building a distribution. bindings: * Fixed VPATH builds. * python: Fixed to link with libomqueryparser. * guile,tcl8: Updated typemaps to SWIG 1.3 style. omega: * omindex.cc: Added missing `#include '. * omindex/scriptindex: Fixed signed character issue in accent normalisation. * omindex: fixed memory and file descriptor leak on indexing a zero-sized file. * omindex: Fixed sense of test for unreadable files. * omindex: Improved log messages to distinguish re-indexed/added. * omindex,omega,scriptindex: Fixed to compile with mingw. * omindex: Fixed to compile with GNU getopt so we can build on non-glibc platforms. examples: * msearch: Quick fix to get mingw building going. * getopt: Copied over our fixes for better C++ compatibility. * simplesearch: Stem search terms. * simpleindex: Fixed not to run words together between lines. * simpleindex: Create database if it doesn't exist. Xapian 0.7.2 (2003-07-11): testsuite: * Fixed NULL pointer dereference when a test threw an unexpected exception. backends: * Quartz: When asked to create a quartz database, try to create the directory if it doesn't already exist. Then we don't have to do it in every single Xapian program which wants to create a database... portability: * common/getopt.h: Fixed to work better with C++ compilers on non-glibc platforms. * common/utils.h: missing #include * Quartz: Defined _XOPEN_SOURCE=500 for GLIBC so we get pread() and pwrite(). * common/utils.h: Improved mingw implementation of rmdir(). documentation: * PLATFORMS: Added MacOS X 10.2 success report. * Improvements to doxygen-generated documentation. bindings: * Moved to separate xapian-bindings module. * Added configure check for SWIG version (require at least 1.3.14). * bindings/swig/xapian.i: Fixed over-enthusiastic automatic conversion of termname to std::string. * PHP4 bindings much closer to working once again; updated guile and tcl8 somewhat. omega: * omega: If the same database is listed more than once, only search the first occurrence. * omega: use snprintf to help guard against buffer overflows. Xapian 0.7.1 (2003-07-08): testsuite: * Fixed testsuite programs to not try to use "rm -rf" under mingw. backends: * Quartz: Use pread() and pwrite() on platforms which support them. Doing so avoids one syscall per block read/write. * Quartz block count is now unsigned, which should nearly double the size of database for a given block size. Not tested this yet. omega: * omindex: Fixed compilation problem in 0.7.0. documentation: * Added new document discussing scalability issues. * PLATFORMS: Updated. Xapian 0.7.0 (2003-07-03): API: * Moved everything into a Xapian namespace, which the main header now being xapian.h (rather than om/om.h). * Three classes have been renamed for better naming consistency: OmOpeningError is now Xapian::DatabaseOpeningError, OmPostListIterator is now Xapian::PostingIterator, and OmPositionListIterator is now Xapian::PositionIterator. * xapian.h includes rather than - if you were relying on the implicit inclusion, you'll need to add an explicit "#include ". * Replaced om_termname with explicit use of std::string - om_termname was just a typedef for std::string and the typedef doesn't really buy us anything. * Older code can be compiled by continuing to use om/om.h which uses #define and other tricks to map the old names onto the new ones. * Define XAPIAN_VERSION (e.g. 0.7.0), XAPIAN_MAJOR_VERSION (e.g. 0), and XAPIAN_MINOR_VERSION (e.g. 7). * Updated omega and xapian-examples to use Xapian namespace. queryparser: * Xapian::QueryParser: Accent normalisation added; Improved error reporting; Fixed to handle the most common examples found in the wild which used to give "parse error". bindings: * Python bindings brought up to date - use ./configure --enable-bindings to build them. Requires Python >= 2.0 - may require Python >= 2.1. * Enabled optional building of bindings as part of normal build process. Old Perl and Java bindings dropped; for Perl, use Search::Xapian from CPAN; Java JNI bindings will be replaced with a SWIG-based implmentation. internal implementation changes: * Removed one wrapper layer from the internal implementation of most API classes. * Xapian::Stem now uses reference counted internals. * Internally a lot of cases of unnecessary header inclusion have been removed or replaced with forward declarations of classes. This should speed up compilation and recompilation of the Xapian library. * Suppress warnings in Snowball generated C code. * Reworked query serialisation in the remote backend so that the code is now all in one place. The serialisation is now rather more compact and no longer relies on flex for parsing. testsuite: * Moved all the core library tests to tests subdirectory. * apitest now allows backend to be specified with "-b" rather than having to mess with environmental variables. * Testsuite programs can now hook into valgrind for leak checking, undefined variable checking, etc. backends: * Fixed parsing of port number in remote stub databases. * Quartz: Improved error message when asked to open a pre-0.6 Quartz database. * Quartz backend: Workaround for shared_level problem turns out to be arguably the better approach, so made it permanent and tidied up code. build system: * Build system fixed to never leave partial files in place of the expected output if a build is interrupted. * quartzcheck, quartzdump, and quartzcompact are now built by "make" rather than only by "make check". * xapian-config: Removed --prefix and --exec-prefix - you can't reliably install Xapian with a different prefix to the one it was configured with, yet these options give the impression you can. miscellaneous: * Fixed sending debug output to a file with XAPIAN_DEBUG_LOG with a value which didn't contain "%%" (%% expands to the current PID). * Fixed Xapian::MSetIterator::get_collapse_count() to work as intended. omega: * omindex,scriptindex: Normalise accents in probabilistic terms. * omindex: Read output from pstotext and pdftotext via pipes rather than temporary files to side-step the whole problem of secure temporary file creation; Use pdfinfo to get the title and keywords from when indexing a PDF; Safe filename escaping tweaked to not escape common safe punctuation. * omindex: Implement an upper limit on the length of URL terms - this is a slightly conservative 240 characters. If the URL term would be longer than this, its last few bytes are replaced by a hash of the tail of the URL. This means that (apart from hopefully very rare collisions) urlterms should still be unique ids for documents. This is forward and backward compatible for URLs less than 240 characters. * omindex: Clean up processing of HTML documents: - Ignore the contents of