The comment_description index now returns the first 25 words of a comment.
svn path=/plone.app.discussion/trunk/; revision=27252
This commit is contained in:
@@ -4,18 +4,22 @@ indexes with values based on the IComment interface.
|
||||
Also provide event handlers to actually catalog the comments.
|
||||
"""
|
||||
|
||||
from string import split, join
|
||||
|
||||
from plone.indexer import indexer
|
||||
|
||||
from plone.app.discussion.interfaces import IComment
|
||||
|
||||
MAX_DESCRIPTION=25
|
||||
|
||||
@indexer(IComment)
|
||||
def comment_title(object):
|
||||
return object.title
|
||||
|
||||
@indexer(IComment)
|
||||
def comment_description(object):
|
||||
# Todo: this is wrong!!!
|
||||
return object.title
|
||||
# Return the first 25 words of the comment text and append '...'
|
||||
return '%s...' % join(object.text.split()[:MAX_DESCRIPTION])
|
||||
|
||||
@indexer(IComment)
|
||||
def comment_searchable_text(object):
|
||||
|
||||
Reference in New Issue
Block a user