diff roundup/backends/rdbms_common.py @ 6588:91ab3e0ffcd0

Summary: Add test cases for sqlite fts Add support for using the FTS5 full text query engine for sqlite. Also stubbed out some sections for adding postgresql FTS support as well. Added nee indexer type native-fts. It is not selected by default. The indexer=native is used if no indexer is set. This prevents an upgrade from seeming to wipe out the native index if upgraded and indexer=native is not explicitly set. Docs updated. Also changed section headers to sentence case for the current release notes. Indexing backend can control if the full text search phrase is broken into a list of words or passed intact. For backends with query languages (sqlite and can be enabled for whoosh and xapian) we do not want the phrase "tokenized" on whitespace. This also updates the rdbms database version to version 7 to add FTS table. I will be using the same version when I add postgresql. If somebody runs this version on postgresql, they will have to manually add the fts tables for postgresql if they want to use it. Added a new renderError method to client. This allows errors to be reported still using page.html rather than raw html. It also supports templates for any error code. If no template for the error code (e.g. 400) is found, the error in raw html with no page frame is shown. New IndexerQueryError exception to pass back message about query syntax errors.
author John Rouillard <rouilj@ieee.org>
date Sun, 23 Jan 2022 18:57:45 -0500
parents c1d3fbcdbfbd
children 39189dd94f2c
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Sat Jan 22 01:33:06 2022 -0500
+++ b/roundup/backends/rdbms_common.py	Sun Jan 23 18:57:45 2022 -0500
@@ -329,8 +329,8 @@
         self.sql_commit()
 
     # update this number when we need to make changes to the SQL structure
-    # of the backen database
-    current_db_version = 6
+    # of the backend database
+    current_db_version = 7
     db_version_updated = False
 
     def upgrade_db(self):
@@ -376,10 +376,18 @@
             self.log_info('upgrade to version 6')
             self.fix_version_5_tables()
 
+        if version < 7:
+            self.log_info('upgrade to version 7')
+            self.fix_version_6_tables()
+
         self.database_schema['version'] = self.current_db_version
         self.db_version_updated = True
         return 1
 
+    def fix_version_2_tables(self):
+        # Default (used by sqlite): NOOP
+        pass
+
     def fix_version_3_tables(self):
         # drop the shorter VARCHAR OTK column and add a new TEXT one
         for name in ('otk', 'session'):
@@ -387,10 +395,6 @@
             self.sql('ALTER TABLE %ss DROP %s_value' % (name, name))
             self.sql('ALTER TABLE %ss ADD %s_value TEXT' % (name, name))
 
-    def fix_version_2_tables(self):
-        # Default (used by sqlite): NOOP
-        pass
-
     def fix_version_4_tables(self):
         # note this is an explicit call now
         c = self.cursor
@@ -411,6 +415,12 @@
         # as version 5.
         pass
 
+    def fix_version_6_tables(self):
+        # Default (used by mysql): NOOP
+        # sqlite/postgres override this to add fts
+        # full text search tables.
+        pass
+
     def _convert_journal_tables(self):
         """Get current journal table contents, drop the table and re-create"""
         c = self.cursor

Roundup Issue Tracker: http://roundup-tracker.org/