##// END OF EJS Templates
audit-logs: fixed search cases with special chars such as `-`....
dan -
r4135:9b536d10 default
parent child
Show More
@@ -22,7 +22,7 import logging
22 22
23 23 from whoosh.qparser.default import QueryParser, query
24 24 from whoosh.qparser.dateparse import DateParserPlugin
25 from whoosh.fields import (TEXT, Schema, DATETIME)
25 from whoosh.fields import (TEXT, Schema, DATETIME, KEYWORD)
26 26 from sqlalchemy.sql.expression import or_, and_, not_, func
27 27
28 28 from rhodecode.model.db import UserLog
@@ -30,11 +30,12 from rhodecode.lib.utils2 import remove_
30 30
31 31 # JOURNAL SCHEMA used only to generate queries in journal. We use whoosh
32 32 # querylang to build sql queries and filter journals
33 JOURNAL_SCHEMA = Schema(
34 username=TEXT(),
33 AUDIT_LOG_SCHEMA = Schema(
34 username=KEYWORD(),
35 repository=KEYWORD(),
36
35 37 date=DATETIME(),
36 38 action=TEXT(),
37 repository=TEXT(),
38 39 ip=TEXT(),
39 40 )
40 41
@@ -52,7 +53,7 def user_log_filter(user_log, search_ter
52 53 log.debug('Initial search term: %r', search_term)
53 54 qry = None
54 55 if search_term:
55 qp = QueryParser('repository', schema=JOURNAL_SCHEMA)
56 qp = QueryParser('repository', schema=AUDIT_LOG_SCHEMA)
56 57 qp.add_plugin(DateParserPlugin())
57 58 qry = qp.parse(safe_unicode(search_term))
58 59 log.debug('Filtering using parsed query %r', qry)
General Comments 0
You need to be logged in to leave comments. Login now