From dd0ca442cc532daea00790560667e92312737231 Mon Sep 17 00:00:00 2001
From: c4pp4
Date: Fri, 23 Oct 2026 12:00:00 +0200
Subject: [PATCH 1/1] Fix build with Xapian 2

Xapian 2 removed Xapian::InMemory::open(), add_valuerangeprocessor()
and NumberValueRangeProcessor. Use the replacements available since
Xapian 1.4: the DB_BACKEND_INMEMORY flag, add_rangeprocessor() and
NumberRangeProcessor (RP_SUFFIX replaces prefix=false). Call release()
so that Xapian deletes the range processors.

Signed-off-by: c4pp4
---
 extensions/fts++/indexer.cpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/extensions/fts++/indexer.cpp b/extensions/fts++/indexer.cpp
index c94ad19..25a6777 100644
--- a/extensions/fts++/indexer.cpp
+++ b/extensions/fts++/indexer.cpp
@@ -60,8 +60,8 @@ void Indexer::Initialize (GError **error)
   {
     if (zeitgeist_utils_using_in_memory_database ())
     {
-      this->db = new Xapian::WritableDatabase;
-      this->db->add_database (Xapian::InMemory::open ());
+      this->db = new Xapian::WritableDatabase (std::string (),
+                                               Xapian::DB_BACKEND_INMEMORY);
     }
     else
     {
@@ -112,10 +112,11 @@ void Indexer::Initialize (GError **error)
         FILTER_PREFIX_SUBJECT_STORAGE);
     this->query_parser->add_prefix ("category", FILTER_PREFIX_XDG_CATEGORY);
 
-    this->query_parser->add_valuerangeprocessor (
-        new Xapian::NumberValueRangeProcessor (VALUE_EVENT_ID, "id"));
-    this->query_parser->add_valuerangeprocessor (
-        new Xapian::NumberValueRangeProcessor (VALUE_TIMESTAMP, "ms", false));
+    this->query_parser->add_rangeprocessor (
+        (new Xapian::NumberRangeProcessor (VALUE_EVENT_ID, "id"))->release ());
+    this->query_parser->add_rangeprocessor (
+        (new Xapian::NumberRangeProcessor (VALUE_TIMESTAMP, "ms",
+                                           Xapian::RP_SUFFIX))->release ());
 
     this->query_parser->set_default_op (Xapian::Query::OP_AND);
     this->query_parser->set_database (*this->db);
@@ -215,8 +216,8 @@ void Indexer::DropIndex ()
 
     if (zeitgeist_utils_using_in_memory_database ())
     {
-      this->db = new Xapian::WritableDatabase;
-      this->db->add_database (Xapian::InMemory::open ());
+      this->db = new Xapian::WritableDatabase (std::string (),
+                                               Xapian::DB_BACKEND_INMEMORY);
     }
     else
     {
-- 
2.55.0

