kb topic search + client-ip port strip + application notes html

This commit is contained in:
2026-07-29 10:09:02 -04:00
parent 0a2d4d0968
commit 9cf026e31a
10 changed files with 189 additions and 20 deletions

View File

@@ -29,12 +29,19 @@ def list_articles():
query = KnowledgeBase.query.filter_by(isactive=True)
# Search
# Search: title, keywords, and the topic (its Application's name). The topic
# is matched via an appid subquery instead of a join so it does not collide
# with the sort=='topic' join below; articles with no app just miss that
# clause and still match on title/keywords.
if search := request.args.get('search'):
like = f'%{search}%'
topic_appids = db.session.query(Application.appid).filter(
Application.appname.ilike(like))
query = query.filter(
db.or_(
KnowledgeBase.shortdescription.ilike(f'%{search}%'),
KnowledgeBase.keywords.ilike(f'%{search}%')
KnowledgeBase.shortdescription.ilike(like),
KnowledgeBase.keywords.ilike(like),
KnowledgeBase.appid.in_(topic_appids)
)
)