add logging of searches

This commit is contained in:
Frédéric Péters 2011-12-04 20:57:32 +01:00
parent 0ee4387f59
commit 569f2b9e89
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import re
import time
import datetime
import logging
from five import grok
from plone.memoize import instance, ram
@ -41,6 +42,8 @@ from tabellio.documents.typenames import MAPPING
import cmpfunctions
log = logging.getLogger('Plone')
class ListAuthorsView(BrowserView):
def get_folder_at_path(self, path):
current = self.portal
@ -702,6 +705,7 @@ class SearchView(BrowserView):
cursor = self.db_connection.cursor()
except AttributeError:
return []
log.info('Calling to postgresql for search (%r)' % text)
# looks like there's no way to quote things properly for to_tsquery,
from plone.i18n.normalizer.fr import normalizer
text = re.sub(r'[^\w\s]', ' ', normalizer.normalize(text))
@ -847,6 +851,7 @@ class SearchView(BrowserView):
catalog = getToolByName(self.context, 'portal_catalog')
print 'kw:', kw
log.info('Performing search (%r)' % kw)
return sorted(catalog(**kw), cmp_function)
def deputy_search_form(self):