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.

Parameters:
message_id
Author:
dave@thedesignexperience.org
Created:
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_html_text_convert ad_html_text_convert (public) ad_log_deprecated ad_log_deprecated (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_html_text_convert forum::message::datasource->ad_log_deprecated forum::message::datasource->db_foreach forum::message::datasource->forum::message::get

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc forum::message::datasource

    # 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">
    <querytext>
        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
      </querytext>
</fullquery>
packages/forums/tcl/forums-sc-procs-postgresql.xql

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