From cbc345eb1e927c80b11b27ea0fd99cbacb9d4125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 17 Aug 2018 13:45:56 +0200 Subject: [PATCH] sql: add display id and formdef name to full-text index (#25643) --- wcs/sql.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wcs/sql.py b/wcs/sql.py index c01b3397..2235ca6f 100644 --- a/wcs/sql.py +++ b/wcs/sql.py @@ -1399,7 +1399,8 @@ class SqlFormData(SqlMixin, wcs.formdata.FormData): cur.execute(sql_statement, sql_dict) evo._sql_id = cur.fetchone()[0] - fts_strings = [str(self.id)] + fts_strings = [str(self.id), self.get_display_id()] + fts_strings.append(self._formdef.name) if self.tracking_code: fts_strings.append(self.tracking_code) for field in self._formdef.get_all_fields(): @@ -2141,7 +2142,7 @@ def get_yearly_totals(period_start=None, period_end=None, criterias=None): return result -SQL_LEVEL = 27 +SQL_LEVEL = 28 def migrate_global_views(conn, cur): cur.execute('''SELECT COUNT(*) FROM information_schema.tables @@ -2243,11 +2244,12 @@ def migrate(): # 21: (second part), store ascii_name of users # 23: (first part), use misc.simplify() over full text queries set_reindex('user', 'needed', conn=conn, cur=cur) - if sql_level < 23: + if sql_level < 28: # 17: store last_update_time in tables # 18: add user name to full-text search index # 21: (third part), add user ascii_names to full-text index # 23: (second part) use misc.simplify() over full text queries + # 28: add display id and formdef name to full-text index set_reindex('formdata', 'needed', conn=conn, cur=cur) if sql_level < 24: from wcs.formdef import FormDef -- 2.18.0