forum::message::datasource (private, deprecated)

 forum::message::datasource message_id

Defined in packages/forums/tcl/forums-sc-procs.tcl

Deprecated. Invoking this procedure generates a warning.

2002-08-07 returns a datasource for the search package this is the content that will be indexed by the full text search engine. We expect message_id to be a root message of a thread only, and return the text of all the messages below DEPRECATED: search is implemented using callbacks now.

See Also:
  • forums-callback-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 ad_conn ad_conn (public) ad_get_tcl_call_stack ad_get_tcl_call_stack (public) ad_html_text_convert ad_html_text_convert (public) db_foreach db_foreach (public) forum::message::get forum::message::get (public) forum::message::datasource forum::message::datasource forum::message::datasource->ad_conn forum::message::datasource->ad_get_tcl_call_stack forum::message::datasource->ad_html_text_convert forum::message::datasource->db_foreach forum::message::datasource->forum::message::get

No testcase defined.
Source code:
ns_log Notice "Deprecated proc forum::message::datasource used:\n[ad_get_tcl_call_stack]"

    # If there is no connection than this proc is called from the
    # search indexer. In that case we set the locale to the
    # system-wide default locale, since locale is needed for some part
    # of the message formatting.
    if { ![ns_conn isconnected] } {
        ad_conn -set locale [lang::system::site_wide_locale]
    forum::message::get -message_id $message_id -array message

    if { $message(parent_id) ne "" } {
        ns_log Notice "forum::message::datasource was called with a message_id that has a parent - skipping: $message_id"
        return {object_id {} name {} charter {} mime {} storage_type {}}

    set tree_sortkey $message(tree_sortkey)
    set forum_id $message(forum_id)
    set combined_content ""
    set subjects [list]
    lappend subjects $message(subject)

    db_foreach messages {} {

        # include the subject in the text if it is different from the thread's subject
        set root_subject $message(subject)
        regexp {^(?:Re: )+(.*)$} $subject match subject

        if { $subject ne $root_subject  } {
            # different subject
            append combined_content "$subject\n\n"

        append combined_content [ad_html_text_convert -from $format -to text/plain -- $content]

        # In case this text is not only used for indexing but also for display, beautify it
        append combined_content "\n\n"

    return [list object_id $message(message_id)  title $message(subject)  content $combined_content  keywords {}  storage_type text  mime text/plain ]
    ns_log Notice "forum::message::datasource end"
XQL Not present:
Generic, Oracle
PostgreSQL XQL file:
<fullquery name="forum::message::datasource.messages">
        select subject, content, format
        from forums_messages
        where message_id=:message_id or (tree_sortkey between tree_left(:tree_sortkey) and tree_right(:tree_sortkey))
        and forum_id=:forum_id
        order by tree_sortkey

[ hide source ] | [ make this the default ]
Show another procedure: