Mercurial > p > roundup > code
diff roundup/cgi/templating.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 | 21c7c2041a4b |
| children | e70e2789bc2c |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Sat Jan 22 01:33:06 2022 -0500 +++ b/roundup/cgi/templating.py Sun Jan 23 18:57:45 2022 -0500 @@ -3318,11 +3318,19 @@ # get the list of ids we're batching over klass = self.client.db.getclass(self.classname) if self.search_text: - matches = self.client.db.indexer.search( - [u2s(w.upper()) for w in re.findall( - r'(?u)\b\w{2,25}\b', - s2u(self.search_text, "replace") - )], klass) + if self.client.db.indexer.query_language: + try: + matches = self.client.db.indexer.search( + [self.search_text], klass) + except Exception as e: + self.client.add_error_message(" ".join(e.args)) + raise + else: + matches = self.client.db.indexer.search( + [u2s(w.upper()) for w in re.findall( + r'(?u)\b\w{2,25}\b', + s2u(self.search_text, "replace") + )], klass) else: matches = None
