Ticket #1736 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

Searches should filter deleted content

Reported by: jukka Owned by: anonymous
Priority: critical Milestone:
Component: generic Version:
Keywords: Cc:
Time planned: Time remaining: 0h
Time spent:

Description

The persistent problem with searches causing errors is because search results try to find and show deleted and trashed objects. Now we go around it with page templates filtering deleted objects, but this causes mismatch between number of found results and number of actual results.

Change History

comment:1 Changed 12 years ago by jukka

(In [2370]) Fixes error messages from search results, better fix needed, see #1736.

comment:2 Changed 12 years ago by pjotr

I've taken a look at that thing today and have some proposals.

  1. This one is a bit off-topic, but still might be somewhat useful

in /skins/lemill/ file livesearch_reply.py

we might replace these two lines:


results = catalog(SearchableText?=r, portal_type=friendly_types)

results = [x for x in results if x.review_state!='deleted']


with one, that might give some small boost of speed:

results = catalog(SearchableText?=r, portal_type=friendly_types, review_state=('public', 'draft'))

  1. In file LeMillTool?.py method OrderingSearch? we might add something like that into the beginning

review_state = REQUEST.form.get('review_state', )

if review_state=="":

REQUEST.formreview_state? = ['public', 'draft']

kwreview_state? = ('public', 'draft')


or


if 'review_state' not in kw.keys():

kwreview_state? = ('public', 'draft')


This should ensure that if no review_state is provided - we only get the public and draft objects from catalog search. SOmething similar is used by queryCatalogForTopics.py in /skins/lemill.

comment:3 Changed 12 years ago by jukka

  • Status changed from new to closed
  • Resolution set to fixed
  • Time remaining set to 0h

(In [2376]) Fixed #1736 according to good suggestions from Pjotr.

Note: See TracTickets for help on using tickets.